You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If we create a new NumpyFieldList with the following code:
# f is a GribFieldvals_new=f.values+1md_new=f.metadata().override(shortName="pt")
ds_new=FieldList.from_numpy(vals_new, md_new)
then the each new NumpyField consists of a numpy array (vals_new) and a metadata object, which stores a GRIB handle cloned from the handle in the original GRIB field but the values in it are not updated with vals_new. See #203 for an explanation.
As a result, there is an inconsistency between the various Field methods related to the values:
# these use the numpy arrayds_new[0].valuesds_new[0].to_numpy()
ds_new[0].data()
# these use the metadata objectds_new[0].metadata("max")
ds_new[0].metadata("bitmapPresent")
ds_new[0].metadata("numberOfMissing")
ds_new[0].metadata(namespace="statistics")
ds_new[0].dump()
ds_new[0].dump(namespace="statistics")
These GRIB keys are in fact not metadata keys but rather related to the actual values in the field. Moreover we can get the correct value related stats by inspecting the numpy array. So the right decision is to hide them in a NumpyFieldLists.
The expected behaviour:
# this throws a KeyErrords_new[0].metadata("max")
ds_new[0].metadata()["max"]
# these return Noneds_new[0].metadata("max", None)
ds_new[0].metadata().get("max")
The "statistics" namespace will be hidden, whether we use the namspace kwarg in metadata() or we use the dump(). E.g. this is how the dump() output would look like:
The text was updated successfully, but these errors were encountered:
Current situation
If we create a new NumpyFieldList with the following code:
then the each new NumpyField consists of a numpy array (
vals_new
) and a metadata object, which stores a GRIB handle cloned from the handle in the original GRIB field but the values in it are not updated withvals_new
. See #203 for an explanation.As a result, there is an inconsistency between the various Field methods related to the values:
The proposed solution
These GRIB keys are in fact not metadata keys but rather related to the actual values in the field. Moreover we can get the correct value related stats by inspecting the numpy array. So the right decision is to hide them in a NumpyFieldLists.
The expected behaviour:
The "statistics" namespace will be hidden, whether we use the
namspace
kwarg inmetadata()
or we use thedump()
. E.g. this is how thedump()
output would look like:The text was updated successfully, but these errors were encountered: