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
{{ message }}
This repository has been archived by the owner on Apr 30, 2021. It is now read-only.
It's become obvious that we need to reintroduce the TimeManager back into esmlab due to all complications that arise when dealing with time operations. Having a dedicated TimeManager class will make both maintenance and extending existing functionality easier.
Currently, all time operations are handled by EsmlabAccessor in esmlab/core.py. This approach has some disadvantages due to xarray's accessor limitations. For instance, because xarray's accessors only accept one argument, which is an xarray.Dataset in our case, it's not possible to pass additional attributes/arguments to this class during instantiation. To resolve this issue, I added a somewhat unpleasant hack ds.esmlab.set_time() to allow passing attributes such as year_offset, time_coord_name duringEsmlabAccessor class instantiation.
EsmlabAccessor class has the following:
Properties
time_attrs: Get the attributes of the time coordinate.
time_bound_attrs: Get the attributes of the time bounds coordinate.
Time Bounds Methods
compute_time_bound_diff: Compute the difference between time bounds
infer_time_bound_var: Infer time_bound variable in a dataset
Time Methods
compute_time: Get the attributes of the time coordinate.
compute_time_var: Compute the time coordinate of a dataset
decode_arbitrary_time: Decode an arbitrary time var of type number
get_time_decoded: Return time decoded
get_time_undecoded
infer_time_coord_name: Infer name for time coordinate in a dataset
isdecoded
sel_time: Return dataset truncated to specified time range.
set_time: store the original time and time_bound data from the dataset;
ensure that time_bound, if present, is not decoded.
time_year_to_midyeardate: Set the time coordinate to the mid-point of the year.
uncompute_time_var: Return time coordinate from object to float.
compute_resample_times: Computes time values for resample operations
Miscellaneous Methods
get_original_metadata
get_variables
restore_dataset: Return the original time variable to decoded or undecoded state.
update_metadata
Ideally, the new/refactored implementation will address a list of issues that have popped up over time: #128, #116, #118, #126, #111
Comments would be helpful from @matt-long, @kmpaul and any others regarding how to approach this refactoring.
The text was updated successfully, but these errors were encountered:
passing attributes such as year_offset, time_coord_name
These seem like dataset attributes. Can you not assign these to the Dataset and/or the time DataArray when creating the Dataset and read them when needed?
It's become obvious that we need to reintroduce the
TimeManager
back into esmlab due to all complications that arise when dealing with time operations. Having a dedicatedTimeManager
class will make both maintenance and extending existing functionality easier.Currently, all time operations are handled by
EsmlabAccessor
inesmlab/core.py
. This approach has some disadvantages due to xarray's accessor limitations. For instance, because xarray's accessors only accept one argument, which is anxarray.Dataset
in our case, it's not possible to pass additional attributes/arguments to this class during instantiation. To resolve this issue, I added a somewhat unpleasant hackds.esmlab.set_time()
to allow passing attributes such as year_offset, time_coord_name duringEsmlabAccessor
class instantiation.EsmlabAccessor
class has the following:Properties
Time Bounds Methods
Time Methods
ensure that time_bound, if present, is not decoded.
Miscellaneous Methods
Ideally, the new/refactored implementation will address a list of issues that have popped up over time: #128, #116, #118, #126, #111
Comments would be helpful from @matt-long, @kmpaul and any others regarding how to approach this refactoring.
The text was updated successfully, but these errors were encountered: