-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected creation of subsetVariables
attribute when loading a dataset
#180
Comments
Steps to reproduce
Also
|
@honzaflash Thanks for the detailed report and the example files! I believe most of the places you said During GenerateDatasetsXml, ERDDAP automatically generates subsetVariables for all table dataset types (unless a dataset type has a special exception that I don't know of) if there are no source subsetVariables. This should be covered in the documentation. Currently for EDDTableFromNcCFFiles, there's a complication (as you noted) that suggested subsetVariables are generated during the reading of the NcCF file (in Table.java). This makes the suggested subsetVariables appear to the rest of ERDDAP (and generateDatasets) to be indistinguishable from source attributes. It also means the code that generates the subsetVariables only knows the source variable names (not the destination names), which is why they use source variable names. Based on checking code history, this has been ERDDAP's behavior for at least 12 years. That doesn't make it right, but it does make it likely folks are relying on this behavior. I'm looking into the best way to move towards the desired behavior. I know you mentioned expected behavior is to continue generating the subsetVariables, but using destination names (instead of the current behavior to use source names). Is your desired behavior to generate the subsetVariables automatically at runtime (current behavior), during GenerateDatasetsXml (other Table dataset type behavior), or both? |
@ChrisJohnNOAA Thank you for the response. (Yes, it appears I confused I suppose I listed the expected behavior as just that -- what I would expect. Not necessarily a behavior that we need. I was working on a python script that generates the It was just unexpected extra work and it took me a while to figure out what was even happening as I was somewhat new to the netCDF format and all the metadata conventions. So to actually answer your question:
|
Describe the bug
When using
EDDTableFromNcCFFiles
ERDDAP unexpectedly showssubsetVariables
attribute in dataset's metadata even though the attribute is not added in thedatasets.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 thesubsetVariables
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 usingGenerateDatasetsXml
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:
erddap/WEB-INF/classes/gov/noaa/pfel/erddap/dataset/EDDTableFromNcCFFiles.java
Line 467 in 2ef97c8
Table
class is used for thedataSourceTable
:erddap/WEB-INF/classes/gov/noaa/pfel/erddap/dataset/EDDTableFromNcCFFiles.java
Line 318 in 2ef97c8
readNcCF
sets the global attribute to a value computed from other attributes:erddap/WEB-INF/classes/gov/noaa/pfel/coastwatch/pointdata/Table.java
Line 8301 in 2ef97c8
EDITED: corrected sourceVariables -> subsetVariables
The text was updated successfully, but these errors were encountered: