Skip to content
This repository has been archived by the owner on Sep 1, 2022. It is now read-only.

DAP2 and netCDF4 group flattening and "/" characters #1224

Closed
lesserwhirls opened this issue Feb 14, 2019 · 2 comments
Closed

DAP2 and netCDF4 group flattening and "/" characters #1224

lesserwhirls opened this issue Feb 14, 2019 · 2 comments
Assignees

Comments

@lesserwhirls
Copy link
Collaborator

When I try to ncdump the following OPeNDAP URL (TDS 4.6.11):

https://data.nodc.noaa.gov/thredds/dodsC/ndbc/cmanwx/2018/12/NDBC_WPOW1_201812_D5_v00.nc

I get the following error (netCDF-C 4.6.1, 4.6.2):

ncdump.exe: https://data.nodc.noaa.gov/thredds/dodsC/ndbc/cmanwx/2018/12/NDBC_WPOW1_201812_D5_v00.nc: https://data.nodc.noaa.gov/thredds/dodsC/ndbc/cmanwx/2018/12/NDBC_WPOW1_201812_D5_v00.nc: NetCDF: Name contains illegal characters

The issue, I think, is that we are flattening the group structure by using the / to construct variable names on the TDS side in an attempt to make the netCDF-4 file work with DAP2, but we are not escaping the / properly when exposing the dataset to users. @DennisHeimbigner - is this similar to #598?

@DennisHeimbigner
Copy link
Contributor

It is actually a bit more complicated. The '/' is prohibited in netcdf names even if escaped
(a decision before my time and one that I thought was incorrect).
So, what is supposed to happen is that the '/' characters in DAP2 names are converted to
the string %2f. Unfortunately, I see that there is a glitch, namely that converting the leading
'/' produces a name that is still illegal. I need modify the code to just drop the leading '/'
character.

DennisHeimbigner added a commit to Unidata/netcdf-c that referenced this issue Feb 15, 2019
re: Unidata/thredds#1224
[note that this is an issue in thredds, but the fix is in netcdf-c]

A thredds server can encode a netcdf-4 file into DAP2
by flattening names to include the containing group path,
where the group names are separated by '/'.

But the '/' is prohibited in netcdf names even if escaped
(a decision before my time).

So, if the netcdf-c/libdap2 code encounters a DAP2 name with '/'
characters, the '/' characters are converted to the string
%2f. Unfortunately, there is a glitch, namely that converting
the leading '/' produces a name that is still illegal. This PR
modifies the code to just drop the leading '/' character.
@DennisHeimbigner
Copy link
Contributor

Fixed by PR Unidata/netcdf-c#1319
Note that this is a netcdf-c pull request.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants