Skip to content

Unexpected creation of subsetVariables attribute when loading a dataset #180

Closed
@honzaflash

Description

@honzaflash

Describe the bug
When using EDDTableFromNcCFFiles ERDDAP unexpectedly shows subsetVariables attribute in dataset's metadata even though the attribute is not added in the datasets.xml configuration nor is it present in the source netCDF file.
Furthermore, it seems to use source variable names - this means that if you rename the variables by using a different <destinationName> the dataset won't load.
Also when using the GenerateDatasetsXml tool the subsetVariables attribute also shows up in the commented "sourceAttributes" section (despite not being an attribute in the source file).

To Reproduce
I will add a separate comment with example files, xml, and instructions.

Expected behavior
subsetVariables attribute continues to be generated but using variable destination names.
subsetVariables will be printed under <addAttributes> and not in the source attributes section when using GenerateDatasetsXml scripts.
Also this behavior should be documented. I did not find any mention of the attribute being generated besides for SOS datasets.

Additional context
I have traced the problem for dataset xml generation.
I believe the "sourceAttributes" in the output xml come from here:

sb.append(writeAttsForDatasetsXml(false, dataSourceTable.globalAttributes(), " "));

Table class is used for the dataSourceTable:
dataSourceTable.readNcCF(sampleFileName, null, tStandardizeWhat, null, null, null);

readNcCF sets the global attribute to a value computed from other attributes:
globalAttributes.set("subsetVariables", subsetVars.toString()); // may be "", that's okay

EDITED: corrected sourceVariables -> subsetVariables

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions