Open sadielbartholomew opened 3 years ago
This is probably easy to fix, but I won't be able to look into it until tomorrow.
Cross-referencing cfdm
as ultimately this emerges when a masked
datum i.e. --
is not handled properly by netcdfread
in cfdm
and gets passed to __int__
.
Adjusting the name of the Issue to be more precise after further investigation has pinned the problem down further...
Note a related issue is to provide more informative error messages in cases of attempted operations on metadata-only CDL where data is essential to the operation, an example being given in https://github.com/NCAS-CMS/cf-python/issues/196#issuecomment-811867896.
With the current
cf
andcfdm
master branches installed, as well as on the current release set, the reading of certain CDL files fails due to aMaskedError
which is raised bynumpy
to indicate an issue with conversion of masked elements. Examples are given below.Update: we think the CDL for which this error emerges is that which has header information only, i.e. from
ncdump -h
and rather than a plainncdump
, though perhaps alsoncdump -c
in certain cases. Notably usingncdump
without the-h
option for header info. only in the cases below results in them being read-in from CDL fine, backing up that theory.Details
After directing an
ncdump -h
on thecontiguous.nc
example tutorial dataset to a new file, I see:As a test I also converted all of the other sample netCDF datasets from our tutorial to CDL:
and tried to read them in as above to see if the problem occurred in other cases. The error also occurs for
geometry.nc.cdl
(but not any other dataset) and emerges at the same line, though does not have the same stack trace:Clearly something about the nature of the original netCDF datasets in those two cases meant the error emerged where it otherwise hasn't, likely that they both have some masked data.
Environment
Note I tested this with the following, as well as for cf 3.8.0 and cfdm 1.8.8.0 with the same dependencies: