Adds a mechanism to bypass automatic format detection.
xarray accessors like dataset.ems are read only and cached. They can not be manually set. Simply doing dataset.ems = SomeFormat(dataset) does not work, and once set a format can not be swapped out. As such, an alternate mechanism to bind formats to datasets was required. The emsarray.state.State class represents this. This has attributes that are modifiable. A new Format instance can be constructed and bound to a dataset - this will set the state.format attribute. When dataset.ems is then accessed, the accessor will first check to see if a custom format has already been bound. If one has been, this will be used, else a new format will be constructed using the usual autodetection method.
This allows for greater flexibility and for overriding the format if autodetection fails.
Adds a mechanism to bypass automatic format detection.
xarray accessors like
dataset.ems
are read only and cached. They can not be manually set. Simply doingdataset.ems = SomeFormat(dataset)
does not work, and once set a format can not be swapped out. As such, an alternate mechanism to bind formats to datasets was required. Theemsarray.state.State
class represents this. This has attributes that are modifiable. A new Format instance can be constructed and bound to a dataset - this will set thestate.format
attribute. Whendataset.ems
is then accessed, the accessor will first check to see if a custom format has already been bound. If one has been, this will be used, else a new format will be constructed using the usual autodetection method.This allows for greater flexibility and for overriding the format if autodetection fails.