Skip to content
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

ncdump error message when unknown filter is used in 4.8.0 could be better... #1996

Closed
edwardhartnett opened this issue May 13, 2021 · 3 comments · Fixed by #2000
Closed

ncdump error message when unknown filter is used in 4.8.0 could be better... #1996

edwardhartnett opened this issue May 13, 2021 · 3 comments · Fixed by #2000

Comments

@edwardhartnett
Copy link
Contributor

When I do an ncdump on a file with an unknown filter, I get an error message in the middle of the ncdump:

netcdf tst_gfs_data_1_zstd_20 {
dimensions:
	grid_xt = 8 ;
	grid_yt = 4 ;
	pfull = 4 ;
	phalf = 5 ;
	time = 1 ;
variables:
	double grid_xt(grid_xt) ;
		grid_xt:cartesian_axis = "X" ;
		grid_xt:long_name = "T-cell longitude" ;
		grid_xt:units = "degrees_E" ;
		grid_xt:_Storage = "contiguous" ;
		grid_xt:_Endianness = "little" ;
		grid_xt:_NoFill = "true" ;
	double lon(grid_xt, grid_yt) ;
		lon:long_name = "T-cell longitude" ;
		lon:units = "degrees_E" ;
		lon:_Storage = "contiguous" ;
		lon:_Endianness = "little" ;
		lon:_NoFill = "true" ;
	double grid_yt(grid_yt) ;
		grid_yt:cartesian_axis = "Y" ;
		grid_yt:long_name = "T-cell latiitude" ;
		grid_yt:units = "degrees_N" ;
		grid_yt:_Storage = "contiguous" ;
		grid_yt:_Endianness = "little" ;
		grid_yt:_NoFill = "true" ;
	double lat(grid_xt, grid_yt) ;
		lat:long_name = "T-cell latitude" ;
		lat:units = "degrees_N" ;
		lat:_Storage = "contiguous" ;
		lat:_Endianness = "little" ;
		lat:_NoFill = "true" ;
	float pfull(pfull) ;
		pfull:_Storage = "contiguous" ;
		pfull:_Endianness = "little" ;
		pfull:_NoFill = "true" ;
	float phalf(phalf) ;
		phalf:_Storage = "contiguous" ;
		phalf:_Endianness = "little" ;
		phalf:_NoFill = "true" ;
	double time(time) ;
		time:_Storage = "contiguous" ;
		time:_Endianness = "little" ;
		time:_NoFill = "true" ;
	float var_0(time, pfull, grid_yt, grid_xt) ;
		var_0:max_abs_compression_error = 42.22f ;
		var_0:nbits = 5 ;
		var_0:_Storage = "chunked" ;
		var_0:_ChunkSizes = 1, 4, 4, 8 ;
		var_0:_Filter = "32015,20" ;
		var_0:_Endianness = "little" ;
		var_0:_NoFill = "true" ;

// global attributes:
		:_NCProperties = "version=2,netcdf=4.8.0,hdf5=1.10.7" ;
		:_SuperblockVersion = 2 ;
		:_IsNetcdf4 = 1 ;
		:_Format = "netCDF-4" ;
NetCDF: HDF error
Location: file vardata.c; line 478
data:

 grid_xt = 0, 1, 100, 101, 200, 201, 300, 301 ;

 lon =
  0, 1, 200, 201,
  2, 3, 202, 203,
  1, 2, 201, 202,
  3, 4, 203, 204,
  100, 101, 300, 301,
  102, 103, 302, 303,
  101, 102, 301, 302,
  103, 104, 303, 304 ;

 grid_yt = 0, 100, 200, 300 ;

 lat =
  0, 1, 200, 201,
  2, 3, 202, 203,
  1, 2, 201, 202,
  3, 4, 203, 204,
  100, 101, 300, 301,
  102, 103, 302, 303,
  101, 102, 301, 302,
  103, 104, 303, 304 ;

 pfull = 0, 100, 200, 300 ;

 phalf = 0, 100, 200, 300, 301 ;

 time = 2 ;

 var_0 =

This is because I am using the zstd filter, and ncdump knows nothing of it since it is not currently installed.

But shouldn't the error message be better? How about something like:
"Unknown HDF5 filter encountered, cannot display data for variable var_0"

@WardF
Copy link
Member

WardF commented May 13, 2021

Tagging @DennisHeimbigner

@DennisHeimbigner
Copy link
Collaborator

We have an NC_ENOFILTER err code that I can use. Or were you referring to a log message?

DennisHeimbigner added a commit to DennisHeimbigner/netcdf-c that referenced this issue May 18, 2021
re: Unidata#1996

Improve the error message and location that is reported when reading a filter with a variable that uses a filter that is not available on the reading platform.

This requires checking the availability of the filter, recording it, and failing when any attempt is made to read or write that variable. A test case was added for this in tst_filter.sh. Also, LOG level 0 message is generated giving the variable and the filter id.

Note that by design if there is no attempt to read or write the variable, then no error is reported; this means that, for example, ncdump -h will list the filter even though it is not actually available. This is important for allowing a user to see the filter details.
@DennisHeimbigner
Copy link
Collaborator

See PR #2000

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

Successfully merging a pull request may close this issue.

3 participants