Hi,

I'm trying to import multidimensional netCDF files slicing the bands
according to time.  I want to use the new temopral module in GRASS70
for further processing.

My process are as follows:

1. Download the netCDF usinf ncks, i.e.:
$ ncks -O -v r -d time,${MIN},${MAX} -d lon,115.00,155.00 -d lat,4.00,22.00 \
http://disc2.nascom.nasa.gov:80/dods/3B42RT_V7_rainrate \
3hourly_trmm_2.nc

This is a 3hourly rainfal  data.

2. Running ncdump, the data are as follows:
$ ncdump -ct 3hourly_trmm_2.nc
netcdf 3hourly_trmm_2 {
dimensions:
    lat = 72 ;
    lon = 160 ;
    time = 89 ;
variables:
    double lat(lat) ;
        lat:grads_dim = "y" ;
        lat:grads_mapping = "linear" ;
        lat:grads_size = "480" ;
        lat:units = "degrees_north" ;
        lat:long_name = "latitude" ;
        lat:minimum = -59.875 ;
        lat:maximum = 59.875 ;
        lat:resolution = 0.25f ;
    double lon(lon) ;
        lon:grads_dim = "x" ;
        lon:grads_mapping = "linear" ;
        lon:grads_size = "1440" ;
        lon:units = "degrees_east" ;
        lon:long_name = "longitude" ;
        lon:minimum = 0.125 ;
        lon:maximum = 359.875 ;
        lon:resolution = 0.25f ;
    float r(time, lat, lon) ;
        r:_FillValue = -99999.f ;
        r:missing_value = -99999.f ;
        r:long_name = "hourly rain rate (mm/hr) " ;
    double time(time) ;
        time:grads_dim = "t" ;
        time:grads_mapping = "linear" ;
        time:grads_size = "131078" ;
        time:grads_min = "00z01mar2000" ;
        time:grads_step = "3hr" ;
        time:units = "days since 1-1-1 00:00:0.0" ;
        time:long_name = "time" ;
        time:minimum = "00z01mar2000" ;
        time:maximum = "15z08jan2045" ;
        time:resolution = 0.125f ;

// global attributes:
        :title = "Three Hourly TRMM and Other Satellite Rainfall (3B42RT)" ;
        :Conventions = "COARDS\n",
            "GrADS" ;
        :dataType = "Grid" ;
        :history = "Tue Nov 11 15:30:44 2014: ncks -O -v r -d
time,41945,42033 -d lon,115.00,155.00 -d lat,4.00,22.00
http://disc2.nascom.nasa.gov:80/dods/3B42RT_V7_rainrate
3hourly_trmm_2.nc\n",
            "Mon Nov 10 23:05:02 GMT-00:00 2014 : imported by GrADS
Data Server 2.0" ;
        :NCO = "4.4.2" ;
data:

 lat = 4.125, 4.375, 4.625, 4.875, 5.125, 5.375, 5.625, 5.875, 6.125, 6.375,
    6.625, 6.875, 7.125, 7.375, 7.625, 7.875, 8.125, 8.375, 8.625, 8.875,
 ... ;

 lon = 115.125, 115.375, 115.625, 115.875, 116.125, 116.375, 116.625,
    116.875, 117.125, 117.375, 117.625, 117.875, 118.125, 118.375, 118.625,
  ... ;

 time = "2014-07-09 03", "2014-07-09 06", "2014-07-09 09", "2014-07-09 12",
    "2014-07-09 15", "2014-07-09 18", "2014-07-09 21", "2014-07-10",
 ... ;
}

3. I want to import it in a GRASS database where the raster filename
correspond to the date/time.

script.run_command('r.in.gdal', input='3hourly_trmm_2.nc', output='g',
flags='o')
script.list_pairs(type='rast')

[('g.1', 'PERMANENT'),
...
 ('g.85', 'PERMANENT')]

As you can see, the band/raster names were just an autoincrement of
the netCDF layers.
Any advice on doing this in Python?  Thanks!


-- 
cheers,
maning
------------------------------------------------------
"Freedom is still the most radical idea of all" -N.Branden
wiki: http://esambale.wikispaces.com/
blog: http://epsg4253.wordpress.com/
------------------------------------------------------
_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Reply via email to