Skip to content

Data variable CRS #21

Open
Open
@benbovy

Description

@benbovy

Currently Dataset.proj("coord_name").crs can be used to access the CRS of either a spatial reference (scalar) coordinate or a CRS-aware indexed coordinate.

This could probably be extended to data variables as well, which may also be CRS-aware if they have spatial dimensions. Dataset.proj("data_var_name").crs could either return:

  • The CRS returned by Dataset.proj("spatial_ref_name").crs if Dataset["data_var_name"].attrs["grid_mapping"] == "spatial_ref_name" (as inspired by CF conventions)
  • Implicitly fallback to Dataset.proj.crs if there is a unique CRS

To set the CRS of a data variable we could reuse Dataset.map_crs(spatial_ref_name=["data_var_name"]), which will basically (re)set the "grip_mapping" attribute of the given data variable(s).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions