WCS is the less-used of the WMS/WFS/WCS triangle so there isn't as much out there as you've probably noticed.
However, making requests is really really easy and you don't really need a special library. Arguably its the easiest of the three from a users perspective because you get a nice simple file back.
A valid request looks something like this:
http://my.host.com/cgi-bin/mapserv?map=mywcs.map&SERVICE=wcs &VERSION=1.0.0&REQUEST=GetCoverage&coverage=bathymetry&CRS=EPSG:42304&OX=-2200000,-712631,3072800,3840000&WIDTH=3199&HEIGHT=2833&FORMAT=GTiff
It may look complex, but broken down its very simple:
http://my.host.com/cgi-bin/mapserv?map=mywcs.map
&SERVICE=wcs
&VERSION=1.0.0
&REQUEST=GetCoverage
&coverage=bathymetry
&CRS=EPSG:42304
&BBOX=-2200000,-712631,3072800,3840000
&WIDTH=3199
&HEIGHT=2833
&FORMAT=GTiff
As you can see, most of them are self explanatory. So you just need to concatenate a string that has those variables. Most of them will probably be constants.
Coverage is the name of the layer you're requesting.
BBOX is the hardest part to do as you need to get the coordinates from somewhere.
I understand the point of libraries, but when something's this simple, "re-inventing the wheel" is actually a sensible option. You do of course need some sort of HTTP library.
A search for WCS GetCoverage finds other examples. This page has a live example: http://www.mapserver.org/ogc/wcs_server.html#test-your-wcs-1-0-server
I cant tell if the lat / lon 2D arrays are correct, or if you are seeing a bug.
One way to test is to bring it up in the ToolsUI (example given).
Go to FeatureType / Grids, open the dataset and see what the grid looks like by hitting the red alien button (twice).
Publishing the dods URL lets others look at it remotely; you should also send what version of netcdf-java you are using.
Best Answer
Here's what we've been doing to set up THREDDS Data Server (TDS) catalogs for regional oceanographic modeling providers in the US Integrated Ocean Observing System to serve their models results.
There are four basic types of catalogs we have been setting up:
So we'll go through each type. But before modifying any catalogs, verify that TDS is up and running with the test catalog and datasets. Go to
http://localhost:8080/thredds
and drill down on one of the test data sets to the OpenDAP service to make sure everything looks okay in the OpenDAP Data Access page.Top level catalog (catalog.xml)
I use the top level catalog as a table of contents whose sole purpose is to point to other catalogs that you want to advertise. The following catalog.xml example is simply pointing to two regional modeling catalogs:
The "All" Catalog (all.xml)
It is quite convenient to have a catalog that automatically allows you to access to all data files in a particular directory tree via the TDS services. The datasetScan feature in the TDS scans a specified directory tree for files matching certain patterns or file extensions.
This could be your whole disk, or just a particular directory. In the following example, the TDS will scan the /data1/models directory for all NetCDF, Grib, or HDF files, sort them by alphabetical order, and include the file size. The data will be served via OpenDAP and HTTP, with HTTP just allowing people to download the existing file in it's native format.
You could reference this catalog in your catalog.xml file, or you might feel that advertising a link to all your data files would be confusing to some users. If you don't put the catalog in catalog.xml, you must add a reference to it in the threddsConfig.xml file in order for it to be read by the TDS.
So if your catalog is called "all.xml", you would need a line in threddsConfig.xml that looks like this:
Regional model catalogs
I suggest that you use a separate catalog for each model domain so that others can link to your catalogs in their own THREDDS catalogs in a more flexible way (e.g. your catalog for Boston Harbor could be referenced in a regional catalog for the Gulf of Maine).
For regional model results, there are typically two types of aggregation datasets that are useful. One aggregates along an existing time dimension, so use type="joinExisting":
where you can use a regular expression (java style) to match only certain files in a directory. Here we are matching files that looks like "mabgom_avg_0001.nc". The "." means any character, so ".*" means any number of any character followed by "mabgom_avg_" followed by exactly 4 digits between 0 and 9, followed by exactly ".nc".
So the entire catalog might look like:
Forecast model catalogs
The other type of very useful catalog is a Forecast Model Run Collection (FMRC), which aggregates forecast files that have overlapping time records (e.g. 3-day forecasts, issued once a day).
For this type of catalog, we use the FMRC FeatureCollection, which creates a "best time series" view, using the most recent data from each forecast to construct a continuous aggregated time series. The files to be scanned are specified in the
collection
tag, and when the files are scanned is specified by either arecheckAfter
tag in the collection tag, or in theupdate
tag.Here's a full example:
Hopefully this is a good starting point.
The best place to find more information on setting up the TDS is usually the documents linked from the latest TDS tutorial from Unidata.
As I type this, the most recent is: https://www.unidata.ucar.edu/software/thredds/current/tds/tutorial/workshop2014.html
which links to: https://www.unidata.ucar.edu/software/thredds/current/tds/tutorial/GettingStarted.html https://www.unidata.ucar.edu/software/thredds/current/tds/reference/collections/FeatureCollections.html