[gdal-dev] define netcdf time dimension

Michael Sumner mdsumner at gmail.com
Mon Apr 13 23:07:30 PDT 2015


On Tue, 14 Apr 2015 at 05:46 Dominik Schneider <
Dominik.Schneider at colorado.edu> wrote:

> Hi -
>
> I have some .mdl files from IDL with .hdr header files that I’d like to
> convert to netcdf.
> The following code produces a netcdf file with a subdataset for each band
> in the mdl file. Is there any way to define the bands as the time
> dimension, in this case 4416 hourly timesteps?
>
> Or is there another tool that can convert this?
>
> gdal_translate -of NetCDF swe.mdl swe.nc
>
>
Can you list the metadata printed out by gdalinfo swe.mdl?  What driver is
used?

Does that source file have time-metadata inside it each subdataset or do
you need to assign it?

Generally, the subdatasets are not considered as a time series - they are
more like multiple variables for the same observation (whereas a 3rd and
higher dimension/s are often unrolled into a multi-attributed 2D layer and
the time/z step is stored on each band -  it's a bit of a mix/clash of
worlds).

Can you point to and example file somewhere?  I imagine you'll need a
programmed solution, but it should be pretty easy with R or python or
similar.  If R is of interest you can try this and take your question to
the R community:

library(raster)
r <- stack("swe.mdl")
r <- setZ(r, [whatever the vector of dates should be])  ## pseudocode
writeRaster(r, "swe.nc")

That all assumes quite a lot, including available NetCDF versions and
packages, required structure in the output, interpretation of the data read
in,  - so it's just included as an indication how it might be done.

Cheers, Mike.


> Thanks
> Dominik​
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20150414/5d82588f/attachment.html>


More information about the gdal-dev mailing list