Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rasterlib: recheck from start #3

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/osgeo4w.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ jobs:
- name: Install pytest plugins
run: python -m pip install pytest-timeout
shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}""
- name: Run pytest with a single worker
run: |
call %OSGEO4W_ROOT%\opt\grass\etc\env.bat
set PYTHONPATH=%GISBASE%\etc\python;%PYTHONPATH%
path %GISBASE%\lib;%GISBASE%\bin;%PATH%
pytest --verbose --color=yes ^
--durations=0 --durations-min=0.5 ^
-ra .
shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}""
# - name: Run pytest with a single worker
# run: |
# call %OSGEO4W_ROOT%\opt\grass\etc\env.bat
# set PYTHONPATH=%GISBASE%\etc\python;%PYTHONPATH%
# path %GISBASE%\lib;%GISBASE%\bin;%PATH%
# pytest --verbose --color=yes ^
# --durations=0 --durations-min=0.5 ^
# -ra .
# shell: cmd /D /E:ON /V:OFF /S /C "CALL C:/OSGeo4W/OSGeo4W.bat "{0}""

- name: Run tests
run: .github/workflows/test_thorough.bat 'C:\OSGeo4W\opt\grass\grass85.bat' 'C:\OSGeo4W\bin\python3'
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/test_thorough.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
set grass=%1
set python=%2

call %grass% --tmp-project XY --exec g.download.project url=https://grass.osgeo.org/sampledata/north_carolina/nc_spm_full_v2alpha2.tar.gz path=%USERPROFILE%
call %grass% --tmp-project XY --exec %python% -m grass.gunittest.main --grassdata %USERPROFILE% --location nc_spm_full_v2alpha2 --location-type nc --min-success 96 --config .github\workflows\osgeo4w_gunittest.cfg
call %grass% --exec g.region s=0 n=90 w=0 e=100 b=0 t=1 rows=3 cols=3 res=10
call %grass% --exec r.mapcalc expr="a = int(row())"
call %grass% --exec r.colors map=a color=elevation
call %grass% --exec r.colors.out map="a" rules="-" format="json" color_format="hex"
2 changes: 1 addition & 1 deletion include/Make/Grass.make
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ NVIZDEPS = $(OGSFLIB) $(GISLIB) $(OPENGLLIB)
OGSFDEPS = $(BITMAPLIB) $(RASTER3DLIB) $(VECTORLIB) $(DBMILIB) $(RASTERLIB) $(GISLIB) $(TIFFLIBPATH) $(TIFFLIB) $(OPENGLLIB) $(OPENGLULIB) $(MATHLIB)
PNGDRIVERDEPS = $(DRIVERLIB) $(GISLIB) $(PNGLIB) $(MATHLIB)
PSDRIVERDEPS = $(DRIVERLIB) $(GISLIB) $(MATHLIB)
RASTERDEPS = $(GISLIB) $(GPROJLIB) $(MATHLIB)
RASTERDEPS = $(GISLIB) $(GPROJLIB) $(MATHLIB) $(PARSONLIB)
RLIDEPS = $(RASTERLIB) $(GISLIB) $(MATHLIB)
ROWIODEPS = $(GISLIB)
RTREEDEPS = $(GISLIB) $(MATHLIB)
Expand Down
4 changes: 4 additions & 0 deletions include/grass/defs/raster.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,10 @@ void Rast__organize_colors(struct Colors *);
/* color_out.c */
void Rast_print_colors(struct Colors *, DCELL, DCELL, FILE *, int);

/* json_color_out.c */
void Rast_print_json_colors(struct Colors *, DCELL, DCELL, FILE *, int,
ColorFormat);

/* color_rand.c */
void Rast_make_random_colors(struct Colors *, CELL, CELL);

Expand Down
2 changes: 2 additions & 0 deletions include/grass/raster.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,8 @@ struct FP_stats {
unsigned long total;
};

typedef enum { RGB, HEX, HSV, TRIPLET } ColorFormat;

struct GDAL_link;
struct R_vrt;

Expand Down
10 changes: 4 additions & 6 deletions raster/r.colors.out/prt_json.c → lib/raster/json_color_out.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
#include <grass/parson.h>
#include <grass/raster.h>

#include "local_proto.h"

#define COLOR_STRING_LENGTH 30

/*!
Expand Down Expand Up @@ -77,7 +75,7 @@ static void rgb_to_hsv(int r, int g, int b, float *h, float *s, float *v)
\param clr_frmt color format to be used (RGB, HEX, HSV, TRIPLET).
\param color_object pointer to the JSON object
*/
static void set_color(int r, int g, int b, enum ColorFormat clr_frmt,
static void set_color(int r, int g, int b, ColorFormat clr_frmt,
JSON_Object *color_object)
{
char color_string[COLOR_STRING_LENGTH];
Expand Down Expand Up @@ -126,7 +124,7 @@ static void set_color(int r, int g, int b, enum ColorFormat clr_frmt,
*/
static void write_json_rule(DCELL *val, DCELL *min, DCELL *max, int r, int g,
int b, JSON_Array *root_array, int perc,
enum ColorFormat clr_frmt, FILE *fp,
ColorFormat clr_frmt, FILE *fp,
JSON_Value *root_value)
{
static DCELL v0;
Expand Down Expand Up @@ -168,8 +166,8 @@ static void write_json_rule(DCELL *val, DCELL *min, DCELL *max, int r, int g,
\param perc TRUE for percentage output
\param clr_frmt color format to be used (RBG, HEX, HSV, TRIPLET).
*/
void print_json_colors(struct Colors *colors, DCELL min, DCELL max, FILE *fp,
int perc, enum ColorFormat clr_frmt)
void Rast_print_json_colors(struct Colors *colors, DCELL min, DCELL max, FILE *fp,
int perc, ColorFormat clr_frmt)
NishantBansal2003 marked this conversation as resolved.
Show resolved Hide resolved
{
JSON_Value *root_value = json_value_init_array();
if (root_value == NULL) {
Expand Down
4 changes: 2 additions & 2 deletions raster/r.colors.out/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ DEPENDENCIES = $(RASTER3DDEP) $(GISDEP) $(RASTERDEP)

PROGRAMS = r.colors.out r3.colors.out

r_colors_out_OBJS = raster_main.o prt_json.o
r3_colors_out_OBJS = raster3d_main.o prt_json.o
r_colors_out_OBJS = raster_main.o
r3_colors_out_OBJS = raster3d_main.o

include $(MODULE_TOPDIR)/include/Make/Multi.make

Expand Down
7 changes: 0 additions & 7 deletions raster/r.colors.out/local_proto.h

This file was deleted.

8 changes: 3 additions & 5 deletions raster/r.colors.out/raster3d_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include <grass/glocale.h>
#include <grass/parson.h>

#include "local_proto.h"

/* Run in raster3d mode */
int main(int argc, char **argv)
{
Expand All @@ -41,7 +39,7 @@ int main(int argc, char **argv)
struct Colors colors;
struct FPRange range;

enum ColorFormat clr_frmt;
ColorFormat clr_frmt;

G_gisinit(argv[0]);

Expand Down Expand Up @@ -102,8 +100,8 @@ int main(int argc, char **argv)
else {
clr_frmt = HEX;
}
print_json_colors(&colors, range.min, range.max, fp,
flag.p->answer ? 1 : 0, clr_frmt);
Rast_print_json_colors(&colors, range.min, range.max, fp,
flag.p->answer ? 1 : 0, clr_frmt);
}
else {
Rast_print_colors(&colors, range.min, range.max, fp,
Expand Down
8 changes: 3 additions & 5 deletions raster/r.colors.out/raster_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
#include <grass/glocale.h>
#include <grass/parson.h>

#include "local_proto.h"

/* Run in raster mode */
int main(int argc, char **argv)
{
Expand All @@ -40,7 +38,7 @@ int main(int argc, char **argv)
struct Colors colors;
struct FPRange range;

enum ColorFormat clr_frmt;
ColorFormat clr_frmt;

G_gisinit(argv[0]);

Expand Down Expand Up @@ -101,8 +99,8 @@ int main(int argc, char **argv)
else {
clr_frmt = HEX;
}
print_json_colors(&colors, range.min, range.max, fp,
flag.p->answer ? 1 : 0, clr_frmt);
Rast_print_json_colors(&colors, range.min, range.max, fp,
flag.p->answer ? 1 : 0, clr_frmt);
}
else {
Rast_print_colors(&colors, range.min, range.max, fp,
Expand Down
8 changes: 4 additions & 4 deletions vector/v.rectify/v.rectify.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ <h3>Coordinate transformation and RMSE</h3>
<p>The desired order of transformation (1, 2, or 3) is selected with the
<b>order</b> option.

If the <b>-r</b> flag is given, <em>v.rectify</em> will calculate the
If the <b>-r</b> flag is given, <em>v.rectify</em> will calculate the
Root Mean Square Error (RMSE) and print out statistics in tabular format.
The last row gives a summary with the first column holding the number of
active points, followed by average deviations for each dimension and both
forward and backward transformation and finally forward and backward
The last row gives a summary with the first column holding the number of
active points, followed by average deviations for each dimension and both
forward and backward transformation and finally forward and backward
overall RMSE.

<h4>2D linear affine transformation (1st order transformation)</h4>
Expand Down
Loading