Skip to content

Commit

Permalink
r.describe: Add JSON support (#4918)
Browse files Browse the repository at this point in the history
  • Loading branch information
NishantBansal2003 authored Jan 24, 2025
1 parent bb58173 commit 1c956f7
Show file tree
Hide file tree
Showing 6 changed files with 825 additions and 66 deletions.
2 changes: 1 addition & 1 deletion raster/r.describe/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ MODULE_TOPDIR = ../..

PGM = r.describe

LIBES = $(RASTERLIB) $(GISLIB)
LIBES = $(RASTERLIB) $(GISLIB) $(PARSONLIB)
DEPENDENCIES = $(RASTERDEP) $(GISDEP)

include $(MODULE_TOPDIR)/include/Make/Module.make
Expand Down
12 changes: 7 additions & 5 deletions raster/r.describe/describe.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
#include <grass/gis.h>
#include <grass/raster.h>
#include <grass/glocale.h>

#include "local_proto.h"

int describe(const char *name, int compact, char *no_data_str, int range,
int windowed, int nsteps, int as_int, int skip_nulls)
int windowed, int nsteps, int as_int, int skip_nulls,
enum OutputFormat format)
{
int fd;
struct Cell_stats statf;
Expand Down Expand Up @@ -127,20 +129,20 @@ int describe(const char *name, int compact, char *no_data_str, int range,
if (range) {
if (compact)
compact_range_list(negmin, negmax, zero, posmin, posmax, null,
no_data_str, skip_nulls);
no_data_str, skip_nulls, format);
else
range_list(negmin, negmax, zero, posmin, posmax, null, no_data_str,
skip_nulls);
skip_nulls, format);
}
else {
Rast_rewind_cell_stats(&statf);

if (compact)
compact_list(&statf, dmin, dmax, no_data_str, skip_nulls, map_type,
nsteps);
nsteps, format);
else
long_list(&statf, dmin, dmax, no_data_str, skip_nulls, map_type,
nsteps);
nsteps, format);

Rast_free_cell_stats(&statf);
}
Expand Down
Loading

0 comments on commit 1c956f7

Please sign in to comment.