<html style="direction: ltr;">
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<style type="text/css">body p { margin-bottom: 0cm; margin-top: 0pt; } </style>
</head>
<body style="direction: ltr;"
bidimailui-detected-decoding-type="latin-charset" 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:"geo_em.d02.nc":GREENFRAC
greenfrac.asc<br>
Now do:<br>
ncdump geo_em.d02.nc | 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<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 06/09/2015 05:47 AM, Thomas Adams
wrote:<br>
</div>
<blockquote
cite="mid:CAGxgkWh6WOC6_Rkhe7f3ZLaE2qOK11K+-L3LC9jGm1a292uNMw@mail.gmail.com"
type="cite">
<div dir="ltr">All:
<div><br>
</div>
<div>Using the help found here: <a moz-do-not-send="true"
href="http://grasswiki.osgeo.org/wiki/NetCDF">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 moz-do-not-send="true"
href="https://drive.google.com/file/d/0B-Dmtz0DFEiubG5aYTk4TDZERXc/view?usp=sharing">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 moz-do-not-send="true" href="http://www.giss.nasa.gov/tools/panoply/">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 moz-do-not-send="true" href="http://geo_em.d02.nc">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 class="gmail_signature"><br>
<div><br>
</div>
</div>
</div>
</div>
<br>
This mail was received via Mail-SeCure System.<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
grass-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/grass-user">http://lists.osgeo.org/mailman/listinfo/grass-user</a>
This mail was received via Mail-SeCure System.
</pre>
</blockquote>
<br>
</body>
</html>