<div dir="ltr"><div><p style="margin:1.2em 0px!important">Hi Mike - Thanks for the response and sorry this wasn’t quite clear. IDL data cubes are of the ENVI format and thus also have an associated ascii .hdr file. A dataset with 10 bands is here:<br><a href="https://dl.dropboxusercontent.com/u/5962491/IDLENVIswe.zip" target="_blank">https://dl.dropboxusercontent.com/u/5962491/IDLENVIswe.zip</a><br> There is no time data in the .mdl file, but I know that the 4416 bands are hourly timesteps from 0:00 March 1 to 23:00 Aug 31</p>
<p style="margin:1.2em 0px!important">I could do this in R but was trying to avoid it because R is always so frustratingly slow for these things…the gdal commandline utilities are much more awesome!</p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;display:block;overflow-x:auto;padding:0.5em;color:rgb(51,51,51);background:none repeat scroll 0% 0% rgb(248,248,248)">iMac:~/Downloads $ gdalinfo swe.mdl
Driver: ENVI/ENVI .hdr Labelled
Files: swe.mdl
       swe.hdr
Size is <span style="color:rgb(0,128,128)">352</span>, <span style="color:rgb(0,128,128)">190</span>
Coordinate System is:
PROJCS[<span style="color:rgb(221,17,68)">"UTM_Zone_13N"</span>,
    GEOGCS[<span style="color:rgb(221,17,68)">"GCS_North_American_1983"</span>,
        DATUM[<span style="color:rgb(221,17,68)">"North_American_Datum_1983"</span>,
            SPHEROID[<span style="color:rgb(221,17,68)">"GRS_1980"</span>,<span style="color:rgb(0,128,128)">6378137.0</span>,<span style="color:rgb(0,128,128)">298.257222101</span>]],
        PRIMEM[<span style="color:rgb(221,17,68)">"Greenwich"</span>,<span style="color:rgb(0,128,128)">0.0</span>],
        UNIT[<span style="color:rgb(221,17,68)">"Degree"</span>,<span style="color:rgb(0,128,128)">0.0174532925199433</span>]],
    PROJECTION[<span style="color:rgb(221,17,68)">"Transverse_Mercator"</span>],
    PARAMETER[<span style="color:rgb(221,17,68)">"False_Easting"</span>,<span style="color:rgb(0,128,128)">500000.0</span>],
    PARAMETER[<span style="color:rgb(221,17,68)">"False_Northing"</span>,<span style="color:rgb(0,128,128)">0.0</span>],
    PARAMETER[<span style="color:rgb(221,17,68)">"Central_Meridian"</span>,-<span style="color:rgb(0,128,128)">105.0</span>],
    PARAMETER[<span style="color:rgb(221,17,68)">"Scale_Factor"</span>,<span style="color:rgb(0,128,128)">0.9996</span>],
    PARAMETER[<span style="color:rgb(221,17,68)">"Latitude_Of_Origin"</span>,<span style="color:rgb(0,128,128)">0.0</span>],
    UNIT[<span style="color:rgb(221,17,68)">"Meter"</span>,<span style="color:rgb(0,128,128)">1</span>]]
Origin = (<span style="color:rgb(0,128,128)">444345.080000000016298</span>,<span style="color:rgb(0,128,128)">4436145.280000000260770</span>)
Pixel Size = (<span style="color:rgb(0,128,128)">30.000000000000000</span>,-<span style="color:rgb(0,128,128)">30.000000000000000</span>)
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  <span style="color:rgb(0,128,128)">444345.080</span>, <span style="color:rgb(0,128,128)">4436145.280</span>) (<span style="color:rgb(0,128,128)">105</span>d39<span style="color:rgb(221,17,68)">' 9.74"W, 40d 4'</span><span style="color:rgb(0,128,128)">25.45</span><span style="color:rgb(221,17,68)">"N)
Lower Left  (  444345.080, 4430445.280) (105d39' 7.97"</span>W, <span style="color:rgb(0,128,128)">40</span>d <span style="color:rgb(0,128,128)">1</span><span style="color:rgb(221,17,68)">'20.58"N)
Upper Right (  454905.080, 4436145.280) (105d31'</span><span style="color:rgb(0,128,128)">43.92</span><span style="color:rgb(221,17,68)">"W, 40d 4'27.72"</span>N)
Lower Right (  <span style="color:rgb(0,128,128)">454905.080</span>, <span style="color:rgb(0,128,128)">4430445.280</span>) (<span style="color:rgb(0,128,128)">105</span>d31<span style="color:rgb(221,17,68)">'42.49"W, 40d 1'</span><span style="color:rgb(0,128,128)">22.85</span><span style="color:rgb(221,17,68)">"N)
Center      (  449625.080, 4433295.280) (105d35'26.03"</span>W, <span style="color:rgb(0,128,128)">40</span>d <span style="color:rgb(0,128,128)">2</span><span style="color:rgb(221,17,68)">'54.21"N)
Band 1 Block=352x1 Type=Float32, ColorInterp=Undefined
Band 2 Block=352x1 Type=Float32, ColorInterp=Undefined
Band 3 Block=352x1 Type=Float32, ColorInterp=Undefined
Band 4 Block=352x1 Type=Float32, ColorInterp=Undefined
Band 5 Block=352x1 Type=Float32, ColorInterp=Undefined
Band 6 Block=352x1 Type=Float32, ColorInterp=Undefined
Band 7 Block=352x1 Type=Float32, ColorInterp=Undefined
Band 8 Block=352x1 Type=Float32, ColorInterp=Undefined
Band 9 Block=352x1 Type=Float32, ColorInterp=Undefined
Band 10 Block=352x1 Type=Float32, ColorInterp=Undefined
...
Band 4416 Block=352x1 Type=Float32, ColorInterp=Undefined</span>
</code></pre>
<div title="MDH:PGRpdj48ZGl2PkhpIE1pa2UgLSBUaGFua3MgZm9yIHRoZSByZXNwb25zZSBhbmQgc29ycnkgdGhp
cyB3YXNuJ3QgcXVpdGUgY2xlYXIuIElETCBkYXRhIGN1YmVzIGFyZSBvZiB0aGUgRU5WSSBmb3Jt
YXQgYW5kIHRodXMgYWxzbyBoYXZlIGFuIGFzc29jaWF0ZWQgYXNjaWkgLmhkciBmaWxlLiBBIGRh
dGFzZXQgd2l0aCAxMCBiYW5kcyBpcyBoZXJlOjxicj5odHRwczovL2RsLmRyb3Bib3h1c2VyY29u
dGVudC5jb20vdS81OTYyNDkxL0lETEVOVklzd2UuemlwPGJyPiZuYnNwO1RoZXJlIGlzIG5vIHRp
bWUgZGF0YSBpbiB0aGUgLm1kbCBmaWxlLCBidXQgSSBrbm93IHRoYXQgdGhlIDQ0MTYgYmFuZHMg
YXJlIGhvdXJseSB0aW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VkPGJyPkJhbmQgOCBCbG9jaz0zNTJ4MSBUeXBlPUZsb2F0MzIsIENvbG9y
SW50ZXJwPVVuZGVmaW5lZDxicj5CYW5kIDkgQmxvY2s9MzUyeDEgVHlwZT1GbG9hdDMyLCBDb2xv
ckludGVycD1VbmRlZmluZWQ8YnI+QmFuZCAxMCBCbG9jaz0zNTJ4MSBUeXBlPUZsb2F0MzIsIENv
bG9ySW50ZXJwPVVuZGVmaW5lZDxicj4uLi48YnI+PC9kaXY+QmFuZCA0NDE2IEJsb2NrPTM1Mngx
IFR5cGU9RmxvYXQzMiwgQ29sb3JJbnRlcnA9VW5kZWZpbmVkPGRpdj5gYGAgPGJyPjxkaXY+PGJy
PjwvZGl2PjwvZGl2Pg==" style="min-height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0">​</div></div><div class="gmail_extra"><br clear="all"><div><div><div>Dominik Schneider</div><div><div>o <a href="tel:303.735.6296" value="+13037356296" target="_blank">303.735.6296</a> | c <a href="tel:518.956.3978" value="+15189563978" target="_blank">518.956.3978</a> </div><div><br></div></div></div></div>
<br><div class="gmail_quote">On Tue, Apr 14, 2015 at 12:07 AM, Michael Sumner <span dir="ltr"><<a href="mailto:mdsumner@gmail.com" target="_blank">mdsumner@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><br><div class="gmail_quote"><div><div>On Tue, 14 Apr 2015 at 05:46 Dominik Schneider <<a href="mailto:Dominik.Schneider@colorado.edu" target="_blank">Dominik.Schneider@colorado.edu</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><p style="margin:1.2em 0px!important">Hi - </p>
<p style="margin:1.2em 0px!important">I have some .mdl files from IDL with .hdr header files that I’d like to convert to netcdf.<br>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?</p><p style="margin:1.2em 0px!important">Or is there another tool that can convert this?<br></p>
<pre style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;font-size:1em;line-height:1.2em;margin:1.2em 0px"><code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline;white-space:pre-wrap;overflow:auto;border-radius:3px;border:1px solid rgb(204,204,204);padding:0.5em 0.7em;display:block!important;display:block;overflow-x:auto;padding:0.5em;color:rgb(51,51,51);background:none repeat scroll 0% 0% rgb(248,248,248)">gdal_translate -of NetCDF swe.mdl <a href="http://swe.nc" target="_blank">swe.nc</a>
</code></pre></div></div></blockquote><div><br></div></div></div><div>Can you list the metadata printed out by gdalinfo swe.mdl?  What driver is used? </div><div><br></div><div>Does that source file have time-metadata inside it each subdataset or do you need to assign it? </div><div><br></div><div>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). </div><div><br></div><div>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: </div><div><br></div><div>library(raster)</div><div>r <- stack("swe.mdl")</div><div>r <- setZ(r, [whatever the vector of dates should be])  ## pseudocode</div><div>writeRaster(r, "<a href="http://swe.nc" target="_blank">swe.nc</a>")</div><div><br></div><div>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. </div><div><br></div><div>Cheers, Mike. </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Thanks<br>Dominik​</div></div>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></blockquote></div></div>
</blockquote></div><br></div></div>