<div dir="ltr">Micha,<div><br></div><div>It looks like your first suggestion worked. I did, however, have to add -b 1 to the end of your line:</div><div><br></div><div> gdal_translate -of AAIGrid NETCDF:"<a href="http://geo_em.d02.nc">geo_em.d02.nc</a>":GREENFRAC greenfrac.asc -b 1<br></div><div><br></div><div>because I was getting the error:</div><div><br></div><div><div>Warning 1: No UNIDATA NC_GLOBAL:Conventions attribute</div><div>Input file size is 420, 320</div><div>ERROR 6: AAIG driver doesn't support 12 bands. Must be 1 band.</div></div><div><br></div><div>There are 12 bands (1 for each month) in the file '<a href="http://geo_em.d02.nc">geo_em.d02.nc</a>', so I had to specify which band number. Then I just needed to change the dx=dy from 1.0 to 1000. in the greenfrac.asc file. The imported file seems to be placed correctly with the right resolution.</div><div><br></div><div>Thank you so much for your help!</div><div><br></div><div>Cheers!</div><div>Tom</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 9, 2015 at 5:22 PM, Micha Silver <span dir="ltr"><<a href="mailto:micha@arava.co.il" target="_blank">micha@arava.co.il</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="direction:ltr" bgcolor="#FFFFFF" text="#000000">
Hi Tom:<br>
<br>
These geo_em* netcdf files do not have any "proper" CRS information
in the headers. So you indeed get a simple X-Y matrix with cellsize
1 when you try to import directly using GDAL. <br>
<br>
One of the ways to work around this (explained in NCAR's user
manual, chapter 4, about p. 59) is to export to an ARCInfo ASCII
file, then manually edit the ASCII file header rows and change the
xllcorner, yllcorner, and cellsize to the correct values. <br>
<br>
So first: <br>
gdal_translate -of AAIGrid NETCDF:"<a href="http://geo_em.d02.nc" target="_blank">geo_em.d02.nc</a>":GREENFRAC
greenfrac.asc<br>
Now do:<br>
ncdump <a href="http://geo_em.d02.nc" target="_blank">geo_em.d02.nc</a> | grep corner<br>
:corner_lats = 36.19099f, 39.06561f, 39.08329f, 36.20801f,
36.19086f, 39.06547f, 39.08319f, 36.20791f, 36.18649f, 39.07011f,
39.0878f, 36.20351f, 36.18636f, 39.06997f, 39.0877f, 36.2034f ;<br>
:corner_lons = -108.7585f, -108.8684f, -104.0023f,
-104.0788f, -108.7641f, -108.8742f, -103.9965f, -104.0732f,
-108.7584f, -108.8686f, -104.0021f, -104.0789f, -108.7639f,
-108.8744f, -103.9963f, -104.0733f ;<br>
<br>
The above "corner_lats" and "corner_lons" are the correct Lon/Lat
for the corners and center for each of the four corner pixels in the
domain 2. The lower left corner of the lower left pixel is at
-108.7585,36.19099. You enter these into the AAI header rows, and
set the cellsize to 1000, then import that altered AAIGrid into
GRASS *in a WGS84 location* .<br>
<br>
One caveat: this method assumes that the whole geo_em.d03 is
projected in a Lon/Lat WGS84 coordinate system, which is wrong, as
you know. The way I know of to get an accurate raster is to parse
out the XLAT and XLONG variables, together with the GREENFRAC
variable you are interested in as a CSV list of lon,lat,greenfac
values, import the values as vector points, and do an interpolation.
<br>
<br>
Another possibility comes to mind, but I've never tried it: You
should be able to convert the above xllcorner and yllcorner values
to your Lambert Conformal Conic projection in advance, and use the
converted values in the AAI header rows. Then import the AAI file
directly into the correct LCC location. You would do this by:<br>
<ol>
<li>create a point vector of a single point (v.in.ascii) from the
Long/Lat values above in an WGS84 location </li>
<li>project that point to your LCC location (v.proj)</li>
<li>get the LCC X-Y coordinates (v.out.ascii)</li>
<li>Edit the header rows with the LCC xllcorner and yllcorner
values</li>
<li>Import into an LCC location (with r.in.gdal -o as you did)<br>
</li>
</ol>
I'd be interested to know if this works :-)<br>
<br>
Regards,<br>
Micha<div><div class="h5"><br>
<br>
<br>
<br>
<div>On 06/09/2015 05:47 AM, Thomas Adams
wrote:<br>
</div>
</div></div><blockquote type="cite"><div><div class="h5">
<div dir="ltr">All:
<div><br>
</div>
<div>Using the help found here: <a href="http://grasswiki.osgeo.org/wiki/NetCDF" target="_blank">http://grasswiki.osgeo.org/wiki/NetCDF</a>
I have been able to import a netcdf file into GRASS 7, but the
data is not scaled correctly.</div>
<div><br>
</div>
<div>My file is found here:</div>
<div><a href="https://drive.google.com/file/d/0B-Dmtz0DFEiubG5aYTk4TDZERXc/view?usp=sharing" target="_blank">https://drive.google.com/file/d/0B-Dmtz0DFEiubG5aYTk4TDZERXc/view?usp=sharing</a></div>
<div><br>
</div>
<div>I created a GRASS LOCATION based on this:</div>
<div><br>
</div>
<div>
<pre>char Lambert;
:grid_mapping_name = "lambert_conformal_conic";
:latitude_of_projection_origin = 37.99999237060547; // double
:longitude_of_central_meridian = -106.0; // double
:standard_parallel = 34.0, 42.0; // double
:earth_radius = 6371229.0; // double
:_CoordinateTransformType = "Projection";
:_CoordinateAxisTypes = "GeoX GeoY";</pre>
<pre></pre>
<pre>which I obtained using <span style="font-family:arial,sans-serif">panoply</span><span style="font-family:arial,sans-serif"> from here: <a href="http://www.giss.nasa.gov/tools/panoply/" target="_blank">http://www.giss.nasa.gov/tools/panoply/</a></span></pre>
<pre>Looking at the file netcdf header information, it's clear the dx=dy=1000m; but, what imports is x=dy=1m resolution even though I set the x & y resolution to 1000m</pre>
<pre>This is my import command:</pre>
<pre>r.in.gdal input=NETCDF:"<a href="http://geo_em.d02.nc" target="_blank">geo_em.d02.nc</a>":GREENFRAC output=greenfrac -o -e --overwrite
</pre>
<pre>which produces..</pre>
<pre>Warning 1: No UNIDATA NC_GLOBAL:Conventions attribute
WARNING: Over-riding projection check
100%
Raster map <greenfrac.1> created.
100%
Raster map <greenfrac.2> created.
100%
Raster map <greenfrac.3> created.
100%
Raster map <greenfrac.4> created.
100%
Raster map <greenfrac.5> created.
100%
Raster map <greenfrac.6> created.
100%
Raster map <greenfrac.7> created.
100%
Raster map <greenfrac.8> created.
100%
Raster map <greenfrac.9> created.
100%
Raster map <greenfrac.10> created.
100%
Raster map <greenfrac.11> created.
100%
Raster map <greenfrac.12> created.
Region for the current mapset updated
r.in.gdal complete.
</pre>
<div>I am virtually certain the lower left corner is placed
correctly, because I can zoom to the lower-left location and
it falls about where it should -- however the spatial extent
of the data is not what it should be, but when zoomed-in
looks correct.</div>
<pre>Any thoughts?</pre>
<pre></pre>
<pre>Thank you,</pre>
<pre>Tom</pre>
<div><br>
</div>
-- <br>
<div><br>
<div><br>
</div>
</div>
</div>
</div>
<br></div></div>
This mail was received via Mail-SeCure System.<br>
<br>
<fieldset></fieldset>
<br>
<pre>_______________________________________________
grass-user mailing list
<a href="mailto:grass-user@lists.osgeo.org" target="_blank">grass-user@lists.osgeo.org</a>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-user</a>
This mail was received via Mail-SeCure System.
</pre>
</blockquote>
<br>
</div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Thomas E Adams, III<div>718 McBurney Drive</div><div>Lebanon, OH 45036</div><div><br></div><div>1 (513) 739-9512 (cell)</div><div><br></div></div>
</div>