<div dir="ltr">James,<div><br></div><div>Can you provide me with a link to the dataset? I have used this data a lot before… this: <a href="https://grasswiki.osgeo.org/wiki/NetCDF" target="_blank">https://grasswiki.osgeo.org/wiki/NetCDF</a> may be helpful.</div><div><br></div><div>There is also this from Micha Silver:</div><div><br></div><div><span style="font-size:13px">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. </span><br style="font-size:13px"><br style="font-size:13px"><span style="font-size:13px">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. </span><br style="font-size:13px"><br style="font-size:13px"><span style="font-size:13px">So first: </span><br style="font-size:13px"><span style="font-size:13px">gdal_translate -of AAIGrid NETCDF:"</span><a href="http://geo_em.d02.nc/" target="_blank" style="font-size:13px">geo_em.d02.nc</a><span style="font-size:13px">":</span><span style="font-size:13px">GREENFRAC greenfrac.asc</span><br style="font-size:13px"><span style="font-size:13px">Now do:</span><br style="font-size:13px"><span style="font-size:13px">ncdump </span><a href="http://geo_em.d02.nc/" target="_blank" style="font-size:13px">geo_em.d02.nc</a><span style="font-size:13px"> | grep corner</span><br style="font-size:13px"><span style="font-size:13px">        :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 ;</span><br style="font-size:13px"><span style="font-size:13px">        :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 ;</span><br style="font-size:13px"><br style="font-size:13px"><span style="font-size:13px">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* .</span><br style="font-size:13px"><br style="font-size:13px"><span style="font-size:13px">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. </span><br style="font-size:13px"><br style="font-size:13px"><span style="font-size:13px">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:</span><br style="font-size:13px"><ol style="font-size:13px"><li style="margin-left:15px">create a point vector of a single point (v.in.ascii) from the Long/Lat values above in an WGS84 location </li><li style="margin-left:15px">project that point to your LCC location (v.proj)</li><li style="margin-left:15px">get the LCC X-Y coordinates (v.out.ascii)</li><li style="margin-left:15px">Edit the header rows with the LCC xllcorner and yllcorner values</li><li style="margin-left:15px">Import into an LCC location (with r.in.gdal -o as you did)</li></ol><span style="font-size:13px"></span></div><div><br></div><div>Best,</div><div>Tom</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 26, 2016 at 11:16 AM, James Maas (MED) <span dir="ltr"><<a href="mailto:J.Maas@uea.ac.uk" target="_blank">J.Maas@uea.ac.uk</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">
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<p>I'm attempting to import a netCDF file (<a href="http://filename.nc" target="_blank">filename.nc</a>) into grass.  It is comprised of daily rainfall raster data over 730 days, for a 4 km x 4 km grid.  I think the resolution is 1 km so about 16 points per day.</p>
<p><br>
</p>
<p>I've been digging around with gdalinfo and it says the following.</p>
<p><br>
</p>
<p>When I use <span style="font-size:12pt">r.in.gdal input=/home/jamaas/research/ra1188uea/Enigma/Rainfall_data/BC_GB_daily.nc output=BC_GB_daily</span></p>
<p><br>
</p>
<p>I get this error</p>
<p><br>
<span style="font-size:12pt"></span></p>
<div>ERROR: Projection of dataset does not appear to match current location.</div>
<div><span style="font-size:12pt"><br>
</span></div>
<div><span style="font-size:12pt">when I use the -o option I get </span></div>
<div><span style="font-size:12pt">
<div>
<div><br>
</div>
<div>Proceeding with import of 0 raster bands...</div>
<div>ERROR: Selected band (1) does not exist</div>
<br>
</div>
<div><br>
</div>
<div>I think I want all of the raster bands, i.e. for all 730 days.  I must be doing something simple incorrectly.</div>
<div><br>
</div>
<div>Any suggestions most welcome.  </div>
<div><br>
</div>
<div>Thanks</div>
<div><br>
</div>
<div>J</div>
<div></div>
<div><br>
</div>
<br>
</span></div>
<div><span style="font-size:12pt"><br>
</span></div>
<div><span style="font-size:12pt"><br>
</span></div>
<div><span style="font-size:12pt">======================================</span><br>
</div>
<p></p>
<p></p>
<div>Driver: netCDF/Network Common Data Format</div>
<div>Files: BC_GB_daily.nc</div>
<div>       BC_GB_daily.nc.aux.xml</div>
<div>Size is 4, 4</div>
<div>Coordinate System is:</div>
<div>PROJCS["unnamed",</div>
<div>    GEOGCS["unknown",</div>
<div>        DATUM["unknown",</div>
<div>            SPHEROID["Spheroid",6377563.396,299.3249646]],</div>
<div>        PRIMEM["Greenwich",0],</div>
<div>        UNIT["degree",0.0174532925199433]],</div>
<div>    PROJECTION["Transverse_Mercator"],</div>
<div>    PARAMETER["latitude_of_origin",49],</div>
<div>    PARAMETER["central_meridian",0],</div>
<div>    PARAMETER["scale_factor",1],</div>
<div>    PARAMETER["false_easting",400],</div>
<div>    PARAMETER["false_northing",-100],</div>
<div>    UNIT["kilometre",1000,</div>
<div>        AUTHORITY["EPSG","9036"]]]</div>
<div>Origin = (328.500000000000000,526.500000000000000)</div>
<div>Pixel Size = (1.000000000000000,-1.000000000000000)</div>
<div>Metadata:</div>
<div>  crs#_CoordinateAxisTypes=GeoX GeoY</div>
<div>  crs#_CoordinateTransformType=Projection</div>
<div>  crs#EPSG_code=EPSG:27700</div>
<div>  crs#false_easting=400</div>
<div>  crs#false_northing=-100</div>
<div>  crs#grid_mapping_name=transverse_mercator</div>
<div>  crs#inverse_flattening=299.3249646</div>
<div>  crs#latitude_of_projection_origin=49</div>
<div>  crs#long_name=coordinate_reference_system</div>
<div>  crs#longitude_of_projection_origin=-2</div>
<div>  crs#scale_factor_at_projection_origin=0.9996012717</div>
<div>  crs#semi_major_axis=6377563.396</div>
<div>  crs#semi_minor_axis=6356256.91</div>
<br>
<p></p>
<div>
<div style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif">
<div><font size="2"><span style="font-size:10pt">
<div>Dr. Jim Maas <br>
<br>
</div>
<div></div>
</span></font></div>
</div>
</div>
</div>
</div>

<br>_______________________________________________<br>
grass-user mailing list<br>
<a href="mailto:grass-user@lists.osgeo.org">grass-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/grass-user" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-user</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Thomas E Adams, III<div>2330 Jack Warner PKWY, #334</div><div>Tuscaloosa, AL 35401</div><div><br></div><div>1 (513) 739-9512 (cell)</div><div><br></div></div></div></div>
</div>