netcdfthredds

How to format netCDF datasets to be compatible with Thredds OGC services


I have a netcdf dataset produced from the NASA LIS model that i want to be able to show through WMS using a Thredds server. The specific dataset and thredds server can be found at https://tethys.byu.edu/thredds/catalog/testAll/anomaly/catalog.html where you can also download the dataset.

The dataset's variables all have time, ensemble, lat, and lon dimensions and a few variables have additional dimensions. There are corresponding variables for those dimensions. When i open the wms endpoint to view the xml, i see under layers that there is

<Layer>
<Title>LIS land surface model output</Title>
</Layer>

But no list of the variables beneath it. I can't find any documentation about required netcdf structure for Thredds and i've tried comparing this to other datasets that work to look for differences but i'm stuck. The catalog files are configured such that you can read .nc files, expose wms services, etc.

What do i need to change to make this file readable by thredds?


Solution

  • The THREDDS Data Server (TDS) ships with a WMS server called ncWMS as a plugin. The short answer is that I do not think ncWMS works for data with an ensemble dimension, as there does not appear to be a way of requesting an ensemble member through the getMap request.

    If my understanding is incorrect, and ncWMS will support data with an ensemble dimension, then you will need to make sure netCDF-java will recognize the ensemble dimension/variable in your example dataset (which it currently does not). The first issue is that netCDF-java does not see the ensemble variable as a coordinate variable. To fix that, you can add a _CoordinateAxisType attribute to the ensemble variable to tell netCDF-Java that it is a coordinate variable. You can do this using NcML, such that you won't need to rewrite the file:

    <?xml version="1.0" encoding="UTF-8"?>
    <ncml:netcdf xmlns:ncml="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" location="/path_to_file/processed_LIS_HIST_201908010000.d01.nc">
      <ncml:variable name="ensemble">
        <ncml:attribute name="_CoordinateAxisType" value="Ensemble" />
      </ncml:variable>
    </ncml:netcdf>
    

    However, the ensemble variable in your example dataset has two dimensions, [ensemble, time], which netCDF-Java does not currently handle. Surprisingly (probably because the time dimension has a size of 1), netCDF-Java and NcML can do the trick here once again with the addition of logicalReduce element to the NcML:

    <?xml version="1.0" encoding="UTF-8"?>
    <ncml:netcdf xmlns:ncml="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" location="/path_to_file/processed_LIS_HIST_201908010000.d01.nc">
      <ncml:variable name="ensemble">
        <ncml:attribute name="_CoordinateAxisType" value="Ensemble" />
        <ncml:logicalReduce dimNames="time" />
      </ncml:variable>
    </ncml:netcdf>
    

    At this point, netCDF-Java will be able to fully recognize the grids within your example dataset.