<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-3" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 14/04/2009 12.13, Hamish wrote:
<blockquote cite="mid:562901.37227.qm@web110011.mail.gq1.yahoo.com"
type="cite">
<pre wrap="">Luigi wrote:
</pre>
<blockquote type="cite">
<pre wrap="">GRASS complains about bands -- the file includes georeferenced
daily climate variables. The file opens OK in viewers such as
Panoply <a class="moz-txt-link-rfc2396E" href="http://www.giss.nasa.gov/tools/panoply/"><http://www.giss.nasa.gov/tools/panoply/></a>.
</pre>
</blockquote>
<pre wrap=""><!---->
Hamish:
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">what does the output of gdalinfo look like?<!---->
</pre>
</blockquote>
</blockquote>
<blockquote type="cite">
<pre wrap="">[...]
Warning 1: No UNIDATA NC_GLOBAL:Conventions attribute
Driver: netCDF/Network Common Data Format
Files: C:\giotto\giotto_data\SRF_1958.AVG.NC
Size is 512, 512
Coordinate System is `'
</pre>
</blockquote>
<pre wrap=""><!---->
^^^ not georeferenced (in a way gdal knows about), but....
</pre>
<blockquote type="cite">
<pre wrap="">Metadata:
NC_GLOBAL#domxmin=-1.262909e+001
NC_GLOBAL#domxmax=4.295537e+001
NC_GLOBAL#domymin=2.129965e+001
NC_GLOBAL#domymax=6.144880e+001
NC_GLOBAL#domzmin=1.050000e+003
NC_GLOBAL#domzmax=1.050000e+003
</pre>
</blockquote>
<pre wrap=""><!---->
do those make sense as lat/lon bounds? (12.63W, 42.96E; 21.29N, 61.44N)
</pre>
</blockquote>
<br>
Yes, it is a bounding box around the Mediterranean Sea.<br>
<br>
<blockquote cite="mid:562901.37227.qm@web110011.mail.gq1.yahoo.com"
type="cite">
<pre wrap="">
</pre>
<blockquote type="cite">
<pre wrap="">Subdatasets:
SUBDATASET_1_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":lon
SUBDATASET_1_DESC=[148x158] lon (32-bit floating-point)
SUBDATASET_2_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":lat
SUBDATASET_2_DESC=[148x158] lat (32-bit floating-point)
</pre>
</blockquote>
<pre wrap=""><!---->
here in the first two subdatasets you have lat and lon maps.
import them, then use the values in them to set grass map bounds with
r.region, instead of the starting 0,512 x 0x512 pixel coords.
</pre>
</blockquote>
<br>
When I try to import to a latlong location, I get<br>
<blockquote>G_set_window(): Illegal latitude for North<br>
</blockquote>
and no raster is created. When I use a projected location, the file
gets imported but then I have bounding coordinates in dd:mm:ss and
r.region complains that those are invalid.<br>
<blockquote>r.region map=SRF_1958.AVG n=61.4488N s=21.29965N
e=43.07446E w=12.74702W<br>
<n=61.4488N> ** illegal value **<br>
</blockquote>
Not sure what I am doing wrong now.<br>
<br>
<blockquote cite="mid:562901.37227.qm@web110011.mail.gq1.yahoo.com"
type="cite">
<pre wrap="">
if you are good at shell scripting you could automate the import of
all the bands and post the script to the NetCDF wiki page for others
who find similar data files.. :)
</pre>
</blockquote>
<br>
"good at shell scripting" is a bit out of reach for me, but will do my
best.<br>
<br>
<blockquote cite="mid:562901.37227.qm@web110011.mail.gq1.yahoo.com"
type="cite">
<blockquote type="cite">
<pre wrap="">SUBDATASET_3_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":ua
SUBDATASET_4_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":va
SUBDATASET_5_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":drag
</pre>
</blockquote>
<pre wrap=""><!---->
.... I assume these move into the actual data (wind velocities?)
</pre>
</blockquote>
<br>
Yes, wind speed among other things: it is output from a regional
climate model.<br>
<br>
<blockquote cite="mid:562901.37227.qm@web110011.mail.gq1.yahoo.com"
type="cite">
<pre wrap="">
Hamish:
</pre>
<blockquote type="cite">
<pre wrap="">you might try to use gdal_translate extract a single band from
the file and convert it into a GeoTiff. Then import the geotiff
into grass. But anything gdal_translate can read r.in.gdal
should be able to read too (with the right options).
</pre>
</blockquote>
<pre wrap=""><!---->
Luigi:
</pre>
<blockquote type="cite">
<pre wrap="">Found out that it is a multi-dataset file:
Got info on subdatasets following directions at
<a class="moz-txt-link-freetext" href="http://www.gdal.org/frmt_netcdf.html">http://www.gdal.org/frmt_netcdf.html</a>
</pre>
</blockquote>
<pre wrap=""><!---->....
</pre>
<blockquote type="cite">
<pre wrap="">There is one subdataset per climate variable. Each subdataset has one
band per day (365 bands). So I translated to geotiff as you suggested.
C:\giotto\giotto_data>gdal_translate -of GTiff -b 1
NETCDF:"SRF_1958.AVG.NC":tamax SRF_1958.AVG.tiff
I then tried to import in grass the geotiff. It imports and display
fine when creating a new location, but no projection info is carried
along so no way to use it with other layers/locations in my grass
dataset.
</pre>
</blockquote>
<pre wrap=""><!---->
good to see the data makes it in.
so the process would look like:
0. gdalinfo to find band names
1. r.in.gdal with magic netcdf input string with filename and data name
(or gdal_translate to geotiff + r.in.gdal)
2. examine lat and lon subdatasets; instead of importing perhaps try
to use 'gdalinfo -stats' to read max/min of lat,lon layers.
3. apply georeferencing info with r.region or gdal_translate for
geotiffs using the -a_srs and -a_ullr options.
</pre>
</blockquote>
<br>
Stuck at point 3. Also tried the -a_ullr option with gdal_translate but
imported GeoTiff does not show up. Maybe GRASS gets the coordinates in
meters as opposed to degrees.<br>
<br>
<tt> +----------------------------------------------------------------------------+<br>
|
|<br>
+----------------------------------------------------------------------------+<br>
| Layer: SRF_1958.AVG Date: Wed Apr 15 01:17:47
2009 |<br>
| Mapset: luigi Login of Creator:
Luigi |<br>
| Location:
EurLCC |<br>
| DataBase:
C:/cygwin/home/andy |<br>
| Title: ( SRF_1958.AVG
) |<br>
| Timestamp:
none |<br>
|----------------------------------------------------------------------------|<br>
|
|<br>
| Type of Map: raster Number of Categories:
255 |<br>
| Data Type:
FCELL |<br>
| Rows:
148 |<br>
| Columns:
158 |<br>
| Total Cells:
23384 |<br>
| Projection: Lambert Conformal
Conic |<br>
| N: 61.4488 S: 21.29965 Res:
0.27127804 |<br>
| E: 43.07446 W: -12.74702 Res:
0.35330051 |<br>
| Range of data: min = 258.227509 max =
303.087402 |<br>
|
|<br>
| Data
Description: |<br>
| generated by
r.in.gdal |<br>
|
|<br>
|
Comments:
|<br>
| r.in.gdal -o input="C:/giotto/giotto_data/SRF_1958.AVG.tiff"
output=\ |<br>
|
"SRF_1958.AVG"
|<br>
</tt><br>
<br>
<blockquote cite="mid:562901.37227.qm@web110011.mail.gq1.yahoo.com"
type="cite">[...]
<blockquote type="cite">
<pre wrap="">Imports fine but still unable to get projection info, so the data is
useless. If Panoply <a class="moz-txt-link-rfc2396E" href="http://www.giss.nasa.gov/tools/panoply/"><http://www.giss.nasa.gov/tools/panoply/></a>
is able to plot the data on a global coastline, the proj info
should be somewhere in the netCDF file:
</pre>
</blockquote>
<pre wrap=""><!---->
is there a special name for this flavour of netcdf file?
ie is it standardized way of geocoding them or some single nasa in-house
method not seen anywhere else?
</pre>
</blockquote>
<br>
Not sure that there is a special name, but digging around I found that
the netCDF file has a companion file with .DDF extension which includes
a PDEF string:<br>
<blockquote>PDEF 158 148 lcc 41.00 15.00 79.00 74.00
30.00 60.00 15.00 30000. 30000.<br>
</blockquote>
whose syntax is documented here
<a class="moz-txt-link-freetext" href="http://grads.iges.org/grads/gadoc/pdef.html">http://grads.iges.org/grads/gadoc/pdef.html</a> as<br>
<blockquote><i>PDEF isize jsize LCC latref lonref iref jref Struelat
Ntruelat slon dx dy</i><br>
</blockquote>
which would suggest this data is pre-projected (no idea what it means)
according to the above link.<br>
<br>
Thanks and sorry if this thread is starting to go off topic,<br>
<br>
Luigi<br>
</body>
</html>