Unidata/thredds

DAP2 and netCDF4 group flattening and "/" characters

lesserwhirls opened this issue · 2 comments

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?

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.

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