home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 353719522

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/pull/1752#issuecomment-353719522 https://api.github.com/repos/pydata/xarray/issues/1752 353719522 MDEyOklzc3VlQ29tbWVudDM1MzcxOTUyMg== 226037 2017-12-23T10:45:55Z 2017-12-23T11:25:16Z MEMBER

@shoyer I'm writing a small helper that looks very much like a decoding filter, but I'm not sure it fits the VariableCoder model.

The intent is to use CF attributes to identify coordinate variables, for example {'units': 'degrees_north'} identify a 'latitude' coordinate, and apply a set of transformations to harmonise datasets from different providers: I rename the coordinates to a known name, for example 'lat' for latitude, and convert to a known unit, for example to 'Pa' for pressure.

To my understanding some of the transformations need to be at a DataArray / Dataset level, not Variable one, because I need to manipulate the names of the coordinate variables and keep the name of the dimensions in sync, for example I'm currently using DataArray.rename a lot, but I also have an example of using DataArray.swap_dims. A simplified example is:

python def harmonise_latitude(dataset): # (xr.Dataset) -> xr.Dataset for coord in dataset.coords.values(): if coord.attrs.get('units') == 'degrees_north': # update the other CF attributes that reference coord.name, for example 'coordinates'. return dataset.rename({coord.name: 'lat'}) return dataset

Would you be open to add support for Dataset -> Dataset decoding filters similar to the Variable -> Variable?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  278335633
Powered by Datasette · Queries took 1.252ms · About: xarray-datasette