[GRASS-dev] r.in.gdal -r and r.import extent=region not working properly?
Markus Neteler
neteler at osgeo.org
Sun Apr 15 12:46:54 PDT 2018
On Sun, Apr 15, 2018 at 8:48 PM, Veronica Andreo <veroandreo at gmail.com> wrote:
> Hi devs,
>
> I just found something odd. I have a CHIRPS tif for Africa [0], but I would
> only need to import Ghana, so I used r.in.gdal -r. However when I visualize
> the data, most of it is nodata, while the full map of Africa has data all
> over the continent. Then, I tried also with r.import extent=region. Same
> result. The only thing providing what I expected to be the right result (a
> subset from the full map) is importing the whole map and then using
> r.mapcalc to clip (i need the space in my hard disk)
>
> These are the commands and r.univar output and I attach a screenshot with
> the visual results:
>
> # import ghana boundaries from GADM
> v.import input=GHA_adm0.shp output=GHA_adm0
> g.region vector=GHA_adm0
>
> # import full map
> r.in.gdal in=Desktop/chirps-v2.0.2003.01.01.tif out=chirps_full
>
> # import subsets
> r.in.gdal -r in=chirps-v2.0.2003.01.01.tif out=chirps_ghana1
> r.import in=chirps-v2.0.2003.01.01.tif out=chirps_ghana2 extent=region
... here r.null is missing, like
r.null chirps_whatever setnull=-9999
# check with
r.univar -e chirps_whatever
> # subset imported full map
> r.mapcalc expression="chirps_ghana3 = chirps_full"
>
> ### r.univar outputs
>
> r.univar chirps_ghana1
>
> n: 12052
> minimum: -9999
^-- this is the hint that r.null is needed
In my test I then got
r.univar -e chirps_v2_0_2017_01_09
100%
total null and non-null cells: 2400000
total null cells: 1181279
Of the non-null cells:
----------------------
n: 1218721
minimum: 0
maximum: 195.447
range: 195.447
mean: 1.41408
mean of absolute values: 1.41408
standard deviation: 5.044
variance: 25.4419
variation coefficient: 356.698 %
sum: 1723369.67863694
1st quartile: 0
median (odd number of cells): 0
3rd quartile: 0
90th percentile: 3.99494
which looks AFAIK reasonable (also graphically)
HTH
markusN
More information about the grass-dev
mailing list