[GRASS-dev] r.in.gdal -r and r.import extent=region not working properly?

Veronica Andreo veroandreo at gmail.com
Sun Apr 15 11:48:05 PDT 2018


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

# subset imported full map
r.mapcalc expression="chirps_ghana3 = chirps_full"

### r.univar outputs

r.univar chirps_ghana1

n: 12052
minimum: -9999
maximum: 0
range: 9999
mean: -9984.07
mean of absolute values: 9984.07
standard deviation: 386.135
variance: 149100
variation coefficient: -3.86751 %
sum: -120327966

r.univar chirps_ghana2

n: 12052
minimum: -9999
maximum: 0
range: 9999
mean: -9984.07
mean of absolute values: 9984.07
standard deviation: 386.135
variance: 149100
variation coefficient: -3.86751 %
sum: -120327966

## full map (region set to ghana)
r.univar chirps_full

n: 12052
minimum: -9999
maximum: 0
range: 9999
mean: -979.822
mean of absolute values: 979.822
standard deviation: 2972.74
variance: 8.83719e+06
variation coefficient: -303.396 %
sum: -11808819

## subset obtained with r.mapcalc
r.univar chirps_ghana3

n: 12052
minimum: -9999
maximum: 0
range: 9999
mean: -979.822
mean of absolute values: 979.822
standard deviation: 2972.74
variance: 8.83719e+06
variation coefficient: -303.396 %
sum: -11808819

What am I doing wrong here? I appreciate any hint :)

I use grass trunk r72618

Cheers,
Vero

[0]
ftp://ftp.chg.ucsb.edu/pub/org/chg/products/CHIRPS-2.0/africa_daily/tifs/p05/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20180415/5802700a/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screenshot_2018-04-15_20-34-23.png
Type: image/png
Size: 141415 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20180415/5802700a/attachment-0001.png>


More information about the grass-dev mailing list