<!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 11/04/2009 11.39, Hamish wrote:
<blockquote cite="mid:614830.45685.qm@web110005.mail.gq1.yahoo.com"
 type="cite">
  <pre wrap="">Luigi wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">I don't seem to be able to import netCDF via r.in.gdal
in grass-6.4.0RC3 osgeo4w version running on XP sp3.

GRASS 6.4.0RC3 (UTM32):C:\ &gt;r.in.gdal
input=SRF_1958.AVG.NC
output=SRF_1958.AVG location=ERA40_SRF
Warning 1: No UNIDATA NC_GLOBAL:Conventions attribute
Location &lt;ERA40_SRF&gt; created
ERROR: Selected band (1) does not exist

Is this something that I should be able to manage to do?
    </pre>
  </blockquote>
  <pre wrap=""><!---->
yes

  </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/">&lt;http://www.giss.nasa.gov/tools/panoply/&gt;</a>.
    </pre>
  </blockquote>
  <pre wrap=""><!---->
what does the output of gdalinfo look like?
  </pre>
</blockquote>
<br>
This is what gdalinfo says:<br>
<blockquote>C:\Documents and Settings\Luigi\Desktop&gt;gdalinfo
C:\giotto\giotto_data\SRF_195<br>
AVG.NC<br>
Warning 1: No UNIDATA NC_GLOBAL:Conventions attribute<br>
Driver: netCDF/Network Common Data Format<br>
Files: C:\giotto\giotto_data\SRF_1958.AVG.NC<br>
Size is 512, 512<br>
Coordinate System is `'<br>
Metadata:<br>
  NC_GLOBAL#domxmin=-1.262909e+001<br>
  NC_GLOBAL#domxmax=4.295537e+001<br>
  NC_GLOBAL#domymin=2.129965e+001<br>
  NC_GLOBAL#domymax=6.144880e+001<br>
  NC_GLOBAL#domzmin=1.050000e+003<br>
  NC_GLOBAL#domzmax=1.050000e+003<br>
Subdatasets:<br>
  SUBDATASET_1_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":lon<br>
  SUBDATASET_1_DESC=[148x158] lon (32-bit floating-point)<br>
  SUBDATASET_2_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":lat<br>
  SUBDATASET_2_DESC=[148x158] lat (32-bit floating-point)<br>
  SUBDATASET_3_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":ua<br>
  SUBDATASET_3_DESC=[365x148x158] ua (32-bit floating-point)<br>
  SUBDATASET_4_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":va<br>
  SUBDATASET_4_DESC=[365x148x158] va (32-bit floating-point)<br>
  SUBDATASET_5_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":drag<br>
  SUBDATASET_5_DESC=[365x148x158] drag (32-bit floating-point)<br>
  SUBDATASET_6_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":tg<br>
  SUBDATASET_6_DESC=[365x148x158] tg (32-bit floating-point)<br>
  SUBDATASET_7_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":ta<br>
  SUBDATASET_7_DESC=[365x148x158] ta (32-bit floating-point)<br>
  SUBDATASET_8_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":qa<br>
  SUBDATASET_8_DESC=[365x148x158] qa (32-bit floating-point)<br>
  SUBDATASET_9_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":rt<br>
  SUBDATASET_9_DESC=[365x148x158] rt (32-bit floating-point)<br>
  SUBDATASET_10_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":et<br>
  SUBDATASET_10_DESC=[365x148x158] et (32-bit floating-point)<br>
  SUBDATASET_11_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":rnfs<br>
  SUBDATASET_11_DESC=[365x148x158] rnfs (32-bit floating-point)<br>
  SUBDATASET_12_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":sh<br>
  SUBDATASET_12_DESC=[365x148x158] sh (32-bit floating-point)<br>
  SUBDATASET_13_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":lwn<br>
  SUBDATASET_13_DESC=[365x148x158] lwn (32-bit floating-point)<br>
  SUBDATASET_14_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":swn<br>
  SUBDATASET_14_DESC=[365x148x158] swn (32-bit floating-point)<br>
  SUBDATASET_15_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":lwd<br>
  SUBDATASET_15_DESC=[365x148x158] lwd (32-bit floating-point)<br>
  SUBDATASET_16_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":psrf<br>
  SUBDATASET_16_DESC=[365x148x158] psrf (32-bit floating-point)<br>
 
SUBDATASET_17_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":tamax<br>
  SUBDATASET_17_DESC=[365x148x158] tamax (32-bit floating-point)<br>
 
SUBDATASET_18_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":tamin<br>
  SUBDATASET_18_DESC=[365x148x158] tamin (32-bit floating-point)<br>
  SUBDATASET_19_NAME=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":rha<br>
  SUBDATASET_19_DESC=[365x148x158] rha (32-bit floating-point)<br>
Corner Coordinates:<br>
Upper Left  (    0.0,    0.0)<br>
Lower Left  (    0.0,  512.0)<br>
Upper Right (  512.0,    0.0)<br>
Lower Right (  512.0,  512.0)<br>
Center      (  256.0,  256.0)</blockquote>
It is not clear what the coordinate system info means: is it just
unprojected, i.e. I am supposed to import the file to a latlong
location in GRASS?<br>
<br>
<blockquote cite="mid:614830.45685.qm@web110005.mail.gq1.yahoo.com"
 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>
<br>
Found out that it is a multi-dataset file:<br>
<blockquote>C:\Documents and Settings\Luigi\Desktop&gt;gdal_translate
-of GTiff -b 1 C:\giotto\<br>
giotto_data\SRF_1958.AVG.NC SRF_1958.AVG.tiff<br>
Warning 1: No UNIDATA NC_GLOBAL:Conventions attribute<br>
Input file contains subdatasets. Please, select one of them for reading.<br>
</blockquote>
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><br>
<blockquote>C:\giotto\giotto_data&gt;gdalinfo
NETCDF:"SRF_1958.AVG.NC":tamax<br>
</blockquote>
There is one subdataset per climate variable. Each subdataset has one
band per day (365 bands). So I translated to geotiff as you suggested.<br>
<blockquote>C:\giotto\giotto_data&gt;gdal_translate -of GTiff -b 1
NETCDF:"SRF_1958.AVG.NC":tamax SRF_1958.AVG.tiff<br>
</blockquote>
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. (by the way r.in.gdal in wxpython gui does not work
grass6.4.0-rc3: I used the tcltk gui).<br>
<br>
I have also tried to import a single band directly using r.in.gdal: as
you pointed out, there is no reason it shouldn't work if gdal_translate
works.<br>
<blockquote>r.in.gdal -e
input=NETCDF:"C:\giotto\giotto_data\SRF_1958.AVG.NC":tamax
output=SRF_1958.AVG band=1 location=ERA_40_SRF2<br>
</blockquote>
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/">&lt;http://www.giss.nasa.gov/tools/panoply/&gt;</a> is
able to plot the data on a global coastline, the proj info should be
somewhere in the netCDF file: do you have an idea how I can make GRASS
aware of the proj info?<br>
<br>
Kind regards, many thanks for useful pointers and hints, and sorry for
late reply,<br>
<br>
Luigi<br>
<br>
<br>
<blockquote cite="mid:614830.45685.qm@web110005.mail.gq1.yahoo.com"
 type="cite">
  <pre wrap="">

see  <a class="moz-txt-link-freetext" href="http://grass.osgeo.org/wiki/MODIS#SST_.28Level_3.29">http://grass.osgeo.org/wiki/MODIS#SST_.28Level_3.29</a>


Hamish



      


  </pre>
</blockquote>
<br>
</body>
</html>