-
Notifications
You must be signed in to change notification settings - Fork 77
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
Add global attribute for data processing level #980
Comments
A minimal example of decorator to add attribute: In [29]: def test_add_attrs(func):
...: def wrapper():
...: da = func()
...: da = da.assign_attrs({"test_attr": "some attribute"})
...: return da
...: return wrapper
...:
In [30]: @test_add_attrs
...: def build_da():
...: return xr.DataArray([1, 2, 3], coords={"channel": ["chA","chB","chC"]})
...:
In [31]: da = build_da()
In [32]: da
Out[32]:
<xarray.DataArray (channel: 3)>
array([1, 2, 3])
Coordinates:
* channel (channel) <U3 'chA' 'chB' 'chC'
Attributes:
test_attr: some attribute |
Out of curiosity, I tried another one with parameters: In [50]: def test_add_attrs(some_str):
...: def inner(func):
...: def wrapper(*args, **kwargs):
...: da = func()
...: da = da.assign_attrs({"input_str": some_str})
...: da = da.assign_attrs({"test_attr": "some attribute"})
...: return da
...: return wrapper
...: return inner
...:
In [51]: @test_add_attrs(some_str="add this string!")
...: def build_da():
...: return xr.DataArray([1, 2, 3], coords={"channel": ["chA","chB","chC"]})
...:
In [52]: da = build_da()
In [53]: da
Out[53]:
<xarray.DataArray (channel: 3)>
array([1, 2, 3])
Coordinates:
* channel (channel) <U3 'chA' 'chB' 'chC'
Attributes:
input_str: add this string!
test_attr: some attribute |
Well, thanks for doing my work for me! Adding a parameter was my first question/to-do 😆 . Though, that inner/wrapper hierarchy plus the use of It does look like a decorator will work. And I completely agree that from a code usability perspective, it's perfect. Hopefully it will work. |
This is the result of my pattern matching 😁 so there are probably redundancy that can be cut down, but it's fun to make it work, haha.
🤞 |
ACDD defines a couple of global attributes that end in the suffix |
Product level attributes will be added only if lat-lon coordinates (and depth for L2 and higher?) are present. |
Addressed in #1001 |
Add a single global attribute that specifies the data processing/product level for the dataset.
The ACDD convention defines the Recommended global attribute
processing_level
, "A textual description of the processing (or quality control) level of the data". Usage of this attribute is also recommended (possibly as part of its ACDD implementation?) in the NASA Earth Science Data and Information System Standards Office document, "Data Product Development Guide (DPDG) for Data Producers version1.1", https://doi.org/10.5067/DOC/ESO/RFC-041VERSION1Another relevant ACDD global attribute is
product_version
, "Version identifier of the data file or product as assigned by the data creator. For example, a new algorithm or methodology could result in a new product_version." ACDD classifies it as Suggested.Related to #817
The text was updated successfully, but these errors were encountered: