From 842a5da4796c240f52fa3e5be3e74ba07d5bb5e0 Mon Sep 17 00:00:00 2001 From: Nishant Bansal Date: Sun, 10 Nov 2024 23:23:36 +0530 Subject: [PATCH] recheck from start Signed-off-by: Nishant Bansal --- .github/workflows/osgeo4w.yml | 18 +++++++++--------- .github/workflows/test_thorough.bat | 6 ++++-- include/Make/Grass.make | 2 +- include/grass/defs/raster.h | 4 ++++ include/grass/raster.h | 2 ++ .../prt_json.c => lib/raster/json_color_out.c | 8 +++----- raster/r.colors.out/local_proto.h | 7 ------- raster/r.colors.out/raster3d_main.c | 8 +++----- raster/r.colors.out/raster_main.c | 8 +++----- vector/v.rectify/v.rectify.html | 8 ++++---- 10 files changed, 33 insertions(+), 38 deletions(-) rename raster/r.colors.out/prt_json.c => lib/raster/json_color_out.c (97%) delete mode 100644 raster/r.colors.out/local_proto.h diff --git a/.github/workflows/osgeo4w.yml b/.github/workflows/osgeo4w.yml index 30add8dde09..f18001ed7af 100644 --- a/.github/workflows/osgeo4w.yml +++ b/.github/workflows/osgeo4w.yml @@ -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' diff --git a/.github/workflows/test_thorough.bat b/.github/workflows/test_thorough.bat index 843adb4c4f0..1db97eefc43 100644 --- a/.github/workflows/test_thorough.bat +++ b/.github/workflows/test_thorough.bat @@ -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" diff --git a/include/Make/Grass.make b/include/Make/Grass.make index 137a45d1955..03e6a98cd7e 100644 --- a/include/Make/Grass.make +++ b/include/Make/Grass.make @@ -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) diff --git a/include/grass/defs/raster.h b/include/grass/defs/raster.h index bbdc8bfeaa1..f81445a374c 100644 --- a/include/grass/defs/raster.h +++ b/include/grass/defs/raster.h @@ -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); diff --git a/include/grass/raster.h b/include/grass/raster.h index 138fb21c3d1..fc22c64a248 100644 --- a/include/grass/raster.h +++ b/include/grass/raster.h @@ -232,6 +232,8 @@ struct FP_stats { unsigned long total; }; +typedef enum { RGB, HEX, HSV, TRIPLET } ColorFormat; + struct GDAL_link; struct R_vrt; diff --git a/raster/r.colors.out/prt_json.c b/lib/raster/json_color_out.c similarity index 97% rename from raster/r.colors.out/prt_json.c rename to lib/raster/json_color_out.c index 816a63e1b0e..e038b74a03b 100644 --- a/raster/r.colors.out/prt_json.c +++ b/lib/raster/json_color_out.c @@ -8,8 +8,6 @@ #include #include -#include "local_proto.h" - #define COLOR_STRING_LENGTH 30 /*! @@ -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]; @@ -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; @@ -169,7 +167,7 @@ static void write_json_rule(DCELL *val, DCELL *min, DCELL *max, int r, int g, \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) + int perc, ColorFormat clr_frmt) { JSON_Value *root_value = json_value_init_array(); if (root_value == NULL) { diff --git a/raster/r.colors.out/local_proto.h b/raster/r.colors.out/local_proto.h deleted file mode 100644 index 5ed09a06e69..00000000000 --- a/raster/r.colors.out/local_proto.h +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include - -enum ColorFormat { RGB, HEX, HSV, TRIPLET }; - -void print_json_colors(struct Colors *colors, DCELL min, DCELL max, FILE *fp, - int perc, enum ColorFormat clr_frmt); diff --git a/raster/r.colors.out/raster3d_main.c b/raster/r.colors.out/raster3d_main.c index 904db24a91f..605e76ac5d6 100644 --- a/raster/r.colors.out/raster3d_main.c +++ b/raster/r.colors.out/raster3d_main.c @@ -23,8 +23,6 @@ #include #include -#include "local_proto.h" - /* Run in raster3d mode */ int main(int argc, char **argv) { @@ -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]); @@ -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, diff --git a/raster/r.colors.out/raster_main.c b/raster/r.colors.out/raster_main.c index 6b4a8ed36ee..c3092458bc8 100644 --- a/raster/r.colors.out/raster_main.c +++ b/raster/r.colors.out/raster_main.c @@ -22,8 +22,6 @@ #include #include -#include "local_proto.h" - /* Run in raster mode */ int main(int argc, char **argv) { @@ -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]); @@ -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, diff --git a/vector/v.rectify/v.rectify.html b/vector/v.rectify/v.rectify.html index a90eefef229..5f6ac718fd7 100644 --- a/vector/v.rectify/v.rectify.html +++ b/vector/v.rectify/v.rectify.html @@ -46,11 +46,11 @@

Coordinate transformation and RMSE

The desired order of transformation (1, 2, or 3) is selected with the order option. -If the -r flag is given, v.rectify will calculate the +If the -r flag is given, v.rectify 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.

2D linear affine transformation (1st order transformation)