issues: 809332917
This data as json
| id | node_id | number | title | user | state | locked | assignee | milestone | comments | created_at | updated_at | closed_at | author_association | active_lock_reason | draft | pull_request | body | reactions | performed_via_github_app | state_reason | repo | type |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 809332917 | MDU6SXNzdWU4MDkzMzI5MTc= | 4914 | Record processing steps into history attribute with context manager | 13906519 | open | 0 | 4 | 2021-02-16T13:55:05Z | 2022-05-23T13:28:48Z | NONE | I often want to record an entry into history of my netcdf file/ xarray. While one can always add it manually, i.e.
I was wondering if there's a better way... In a first attempt I tried using a context manager for this. Not sure if there are other approaches? Would that be something useful for xarray core? What are other people using for this? Demo: ```python import datetime import xarray as xr class XrHistory():
ds is any xarray dataset...with XrHistory(ds, "normalise data") as ds: ds["array_one"] = (ds.array_one - ds.array_one.mean(dim='time')) / ds.array_one.std(dim='time') with XrHistory(ds, "subset data") as ds: ds = ds.sel(x=slice(10, 20), y=slice(10,20)) ...``` |
{
"url": "https://api.github.com/repos/pydata/xarray/issues/4914/reactions",
"total_count": 0,
"+1": 0,
"-1": 0,
"laugh": 0,
"hooray": 0,
"confused": 0,
"heart": 0,
"rocket": 0,
"eyes": 0
} |
13221727 | issue |