[mapserver-users] WCS that reads NetCDF files returns "Image handling error. Attempt to operate on GDAL file with no bands"
Roger André
randre at gmail.com
Fri Feb 27 11:40:32 PST 2009
Hi Norman,
Sorry for the direct email, but much of the relevant documentation
that I have found regarding this topic appears to have been written by
you. I'm hoping you can take the time to share a bit more of your
wisdom regarding this.
I would like to setup a Mapserver WCS service that reads a single
netCDF file as the data source. Later on I'd like to get fancy and
read multiple files as a tileindex, with multiple time slices in them,
but for now I am just trying to read a single file with a one-band
data layer in it. I am using the example you posted on the Mapserver
website, http://mapserver.org/ogc/wcs_format.html, as well as an old
post from you -
http://lists.osgeo.org/pipermail/mapserver-users/2005-November/012153.html.
The examples are great, but I'm having trouble adapting them to my
sample data.
I have downloaded a CF convention netCDF file from
http://www.unidata.ucar.edu/software/netcdf/examples/sresa1b_ncar_ccsm3_0_run1_200001.nc,
which contains a SUBDATASET named "tas". This SUBDATASET contains
only a single band, which when queried by gdalinfo looks like this
(Note: I have omitted the Metadata for clarity.)
---------------------------
$ gdalinfo NETCDF:"sresa1b_ncar_ccsm3_0_run1_200001.nc":tas
Warning 1: Latitude grid not spaced evenly.
Seting projection for grid spacing is within 0.1 degrees threshold.
Driver: netCDF/Network Common Data Format
Files: none associated
Size is 256, 128
Coordinate System is `'
Origin = (-0.703125000000000,89.627952755905511)
Pixel Size = (1.406250000000000,-1.400436761811024)
Corner Coordinates:
Upper Left ( -0.7031250, 89.6279528)
Lower Left ( -0.7031250, -89.6279528)
Upper Right ( 359.297, 89.628)
Lower Right ( 359.297, -89.628)
Center ( 179.2968750, 0.0000000)
Band 1 Block=256x1 Type=Float32, ColorInterp=Undefined
NoData Value=1.00000002004087734e+20
Metadata:
NETCDF_VARNAME=tas
NETCDF_DIMENSION_time=730136
NETCDF_time_units=days since 0000-1-1
--------------------------
I have setup a mapfile to read this file/layer which looks like this:
--------------------------
MAP
NAME 'netcdf'
OUTPUTFORMAT
NAME "GEOTIFF_FLOAT"
DRIVER 'GDAL/GTiff'
MIMETYPE 'image/tiff'
IMAGEMODE FLOAT32
EXTENSION 'tif'
END
LAYER
NAME "tas"
STATUS OFF
TYPE RASTER
DUMP TRUE
DATA "sresa1b_ncar_ccsm3_0_run1_200001.nc"
METADATA
wcs_label "Test netCDF Server"
ows_extent '-0.7031250 -89.6279528 359.297 89.628' # <-- 0 to 360?
wcs_resolution '1.406250000000000 -1.400436761811024'
ows_srs "EPSG:4326" # <-- Not sure about this
wcs_formats "GEOTIFF_FLOAT"
wcs_nativeformat "netCDF"
wcs_bandcount "1" # <-- Not sure about this
wcs_rangeset_axes "bands"
wcs_rangeset_label "Atmospheric Levels"
wcs_rangeset_name "tas" # <-- Not sure about this
END # end metadata
END # end layer
END # map
------------------------
I took a stab at what the wcs and ows entries should look like in the
METADATA section, but I'm not at all sure I got them right. For
example, the geographic extents of all the netCDF files I have seen so
far seem to use a 0 - 360 longitude range. I'm not really sure how to
reconcile this with the ows_srs of EPSG:4326, of how to properly list
the extents. I used what gdalinfo reports, thinking that since gdal
would be reading the file, the info should match.
With this mapfile, I am able to execute a DescribeCoverage request
using the following command:
---------------------------
http://localhost/cgi-bin/mapserv?map=/var/www/mapfiles/netCDF/netcdf.map
&SERVICE=WCS
&VERSION=1.0.0
&REQUEST=DescribeCoverage
&COVERAGE=tas
---------------------------
I've attached the XML that is returned, it appears to be reasonable,
but whether it is correct or not, I'm not sure. What is certain
though, is that when I try to make a GetCoverage request, I get back a
consistent error that says "Attempt to operate on GDAL file with no
bands, layer=tas". My GetCoverage request looks like this:
---------------------------
http://localhost/cgi-bin/mapserv?map=/var/www/mapfiles/netCDF/netcdf.map
&SERVICE=wcs
&VERSION=1.0.0
&REQUEST=GetCoverage
&coverage=tas
&CRS=EPSG:4326
&BBOX=-0.703125,-89.6279528,359.297,89.628
&WIDTH=600
&HEIGHT=600
&FORMAT=image/tiff
---------------------------
The error that is returned looks like this:
---------------------------
<?xml version='1.0' encoding="ISO-8859-1" ?>
<ServiceExceptionReport version="1.2.0"
xmlns="http://www.opengis.net/ogc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/ogc
http://schemas.opengis.net/wcs/1.0.0/OGC-exception.xsd">
<ServiceException>msGetGDALBandList(): Image handling error. Attempt
to operate on GDAL file with no bands, layer=tas.
</ServiceException>
</ServiceExceptionReport>
----------------------------
And now I am stuck. Since there are quite a few different parameters
that need to be set, I'm not sure which of them I've messed up.
Thanks in advance for any assistance you could provide with this.
Roger
--
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tas_netcdf_coverage.xml
Type: text/xml
Size: 2500 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20090227/62439860/attachment.xml>
More information about the MapServer-users
mailing list