[GRASS-user] trouble with netCDF input arguments for r.in.gdal

Jennifer Boehnert boehnert at ucar.edu
Mon Oct 1 11:22:00 PDT 2012


Hi Kirk,
in your r.in.gdal syntax the time_bnds is the variable you want to 
read.  My guess would be the variable you want to read is pet.

I would suggestion executing the following commands to read your file 
metadata before running the r.in.gdal.

/gdalinfo D:\data\projects\courses2012\IAI\data\B1_tas.nc
/


This will  give you the variable names in your dataset.  In your case I 
see PET

Then to find the dimensions on the variable of interest execute The 
syntax is your netCDF name : variable name

/gdalinfo NETCDF:D:\data\projects\courses2012\IAI\data\A2_tas.nc:tasC /

In my example the netCDF name is A2_tas.nc an the variable I want is 
tasC (temperature in degrees celsius).  My data has 10 temporal dimensions.
You should put <netCDF Name>:PET

Now that I know this I run the r.in.gdal

/r.in.gdal -o -e input=NETCDF: 
D:\data\projects\courses2012\IAI\data\A2_tas.nc:tasC output=SRESA2_tas/

In this example I am bringing in all times if you want specify just 1 
time you can do so by using the BAND number.
Jennifer
On 10/1/2012 12:02 PM, Kirk Wythers wrote:
> I am trying to read some netCDF data (from the CRU climate database) 
> into grass. I am looking at the netcdf wiki page and having a little 
> trouble translating the instructions there to the output I am getting 
> from "gdalinfo". Here is the
>
> If I am trying to use syntax that looks something like:
> r.in.gdal input=NETCDF:"sst.nc":time_bnds output=sst
> I am getting the following error:
>
> ERROR 4: 
> `NETCDF:~/Downloads/cru_ts_3_10.1901.2009.pet.dat.nc:time_bnds' does 
> not exist in the file system,
> and is not recognised as a supported dataset name.
>
> In my case, the PATH_TO_FILE is
>
> "~/Downloads/cru_ts_3_10.1901.2009.pet.dat.nc"
>
> However, I can't tell what to use in the place of ":time_bnds". Any 
> ideas from the pasted text below of what my input argument should look 
> like?
>
> Thanks in advance,
>
> Kirk
>
>
> Here is output I am looking at from gdalinfo:
>
> GRASS 6.4.1 (globe_30min):~ > gdalinfo 
> ~/Downloads/cru_ts_3_10.1901.2009.pet.dat.nc
> ERROR 1: GDAL/GRASS57 driver was compiled against GDAL 1.8 but current 
> library version is 1.9
>
> ERROR 1: GDAL/GRASS57 driver was compiled against GDAL 1.8 but current 
> library version is 1.9
>
> Driver: netCDF/Network Common Data Format
> Files: 
> /Network/Servers/truffula.fr.umn.edu/Volumes/disk1/home1/kirkw/Downloads/cru_ts_3_10.1901.2009.pet.dat.nc 
> <http://truffula.fr.umn.edu/Volumes/disk1/home1/kirkw/Downloads/cru_ts_3_10.1901.2009.pet.dat.nc>
> Size is 720, 360
> Coordinate System is `'
> Origin = (-180.000000000000000,90.000000000000000)
> Pixel Size = (0.500000000000000,-0.500000000000000)
> Metadata:
>   lat#long_name=latitude
>   lat#units=degrees_north
>   lon#long_name=longitude
>   lon#units=degrees_east
>   NC_GLOBAL#comment=Data restrictions: for academic research use 
> only.Contact BADC for details
>   NC_GLOBAL#contact=BADC <badc at rl.ac.uk <mailto:badc at rl.ac.uk>>
>   NC_GLOBAL#Conventions=CF-1.4
>   NC_GLOBAL#history=Wed Feb  2 03:32:36 GMT 2011 : User badc : Program 
> makegridsauto.for called by update.for
>   NC_GLOBAL#institution=Data held at British Atmospheric Data Centre, 
> RAL, UK.
>   NC_GLOBAL#references=Information on the data is available at 
> http://badc.nerc.ac.uk/data/cru/
>   NC_GLOBAL#source=Run ID = 1102011219
> Data generated by BADC from:
> tmp.1009221824.dtb
> dtr.1009221824.dtb
> vap.1009221824.dtb
> cld.1009221824.dtb
>   NC_GLOBAL#title=CRU TS 3.10 Potential Evapotranspiration
>   pet#_FillValue=9.969209968386869e+36
>   pet#correlation_decay_distance=-999
>   pet#long_name=potential evapotranspiration
>   pet#missing_value=9.969209968386869e+36
>   pet#units=mm
>   time#calendar=gregorian
>   time#long_name=time
>   time#units=days since 1900-1-1
> Corner Coordinates:
> Upper Left  (-180.0000000,  90.0000000)
> Lower Left  (-180.0000000, -90.0000000)
> Upper Right ( 180.0000000,  90.0000000)
> Lower Right ( 180.0000000, -90.0000000)
> Center      (   0.0000000,   0.0000000)
> Band 1 Block=720x1 Type=Float64, ColorInterp=Undefined
>   NoData Value=9.96920996838686905e+36
>   Metadata:
>     _FillValue=9.969209968386869e+36
>     correlation_decay_distance=-999
>     long_name=potential evapotranspiration
>     missing_value=9.969209968386869e+36
>     NETCDF_DIMENSION_time=380
>     NETCDF_time_units=days since 1900-1-1
>     NETCDF_VARNAME=pet
>     units=mm
> Band 2 Block=720x1 Type=Float64, ColorInterp=Undefined
>   NoData Value=9.96920996838686905e+36
>   Metadata:
>     _FillValue=9.969209968386869e+36
>     correlation_decay_distance=-999
>     long_name=potential evapotranspiration
>     missing_value=9.969209968386869e+36
>     NETCDF_DIMENSION_time=410
>     NETCDF_time_units=days since 1900-1-1
>     NETCDF_VARNAME=pet
>     units=mm
> .
> .
> .
> .
> Band 1308 Block=720x1 Type=Float64, ColorInterp=Undefined
>   NoData Value=9.96920996838686905e+36
>   Metadata:
>     _FillValue=9.969209968386869e+36
>     correlation_decay_distance=-999
>     long_name=potential evapotranspiration
>     missing_value=9.969209968386869e+36
>     NETCDF_DIMENSION_time=40161
>     NETCDF_time_units=days since 1900-1-1
>     NETCDF_VARNAME=pet
>     units=mm
>
>
>
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20121001/f03fead2/attachment-0001.html>


More information about the grass-user mailing list