Re: [thredds] Using the NC4 String type for a variable containing a "cf_role" attribute

Hi Kyle,

In string_type.nc, you've attached the cf_role=="timeseries_id" attribute to feature_type_instance, and you declare it like this:

    String feature_type_instance(feature_type_instance=1);
      :cf_role = "timeseries_id";
      :long_name = "Identifier for each feature type instance";

In the case of a single-timeseries dataset, where station variables such as lon, lat, and alt are declared as scalars, the "timeseries_id" variable must also be a scalar. So, the variable should be declared like this:

    String feature_type_instance;
      :cf_role = "timeseries_id";
      :long_name = "Identifier for each feature type instance";

The only exception to this rule is if the "timeseries_id" variable is of type CHAR, in which case it can be a 1D array (as in char_type.nc).

I've attached a small NCML file that fixes string_type.nc by removing the feature_type_instance dimension and converting the feature_type_instance variable to a scalar. Be sure to change the value of the netcdf:location attribute to the path of the file on your machine.

Cheers,
Christian Ward-Garrison


On 12/12/2013 1:27 PM, Kyle Wilcox wrote:
I have two files where the only difference is the variable type of the
"feature_type_instance" variable.

When using a Char array, it works just fine.
When using a String, NCJ fails to find a StructureRecord:

java.lang.IllegalStateException: Cant find Structure record
     at
ucar.nc2.ft.point.standard.Table$TableStructure.<init>(Table.java:253)
     at ucar.nc2.ft.point.standard.Table.factory(Table.java:110)
     at ucar.nc2.ft.point.standard.NestedTable.<init>(NestedTable.java:98)
     at
ucar.nc2.ft.point.standard.TableAnalyzer.analyze(TableAnalyzer.java:406)
     at
ucar.nc2.ft.point.standard.TableAnalyzer.factory(TableAnalyzer.java:294)
     at
ucar.nc2.ft.point.standard.PointDatasetStandardFactory.isMine(PointDatasetStandardFactory.java:114)
     at
ucar.nc2.ft.FeatureDatasetFactoryManager.wrap(FeatureDatasetFactoryManager.java:272)
     at
ucar.nc2.ft.FeatureDatasetFactoryManager.open(FeatureDatasetFactoryManager.java:243)

You can try loading each file into the FeatureTypes/PointFeature tab to
see the stacktrace from the String file (I've attached them).

Based on CF docs
(http://cf-pcmdi.llnl.gov/documents/cf-conventions/1.6/cf-conventions.html#coordinates-metadata)
it states:
"The variable carrying the cf_role attribute may have any data type."


Is this a bug in NCJ?

Thanks,
Kyle


_______________________________________________
thredds mailing list
thredds@xxxxxxxxxxxxxxxx
For list information or to unsubscribe,  visit: 
http://www.unidata.ucar.edu/mailing_lists/

<?xml version="1.0" encoding="UTF-8"?>
<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"; 
location="C:/Users/cwardgar.UNIDATA_DOMAIN/Desktop/string_type.nc">
  <remove name="feature_type_instance" type="dimension"/>
  <variable name="feature_type_instance" shape=""/>
</netcdf>
  • 2014 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the thredds archives: