Skip to content

Update encode_as to switch coordinates #288

@rajeeja

Description

@rajeeja

Requirement: cartesian data to latlon and vice-versa for a grid file.

The current function encode_as has an output grid type as the only argument.
Can we add another argument that can change the grid from cartesian to spherical?

Current implementation:

    def encode_as(self, grid_type):
        """Encodes the grid as a new `xarray.Dataset` per grid format supplied
        in the `grid_type` argument.

        Parameters
        ----------
        grid_type : str, required
            Grid type of output dataset.
            Currently supported options are "ugrid", "exodus", and "scrip"

        Returns
        -------
        out_ds : xarray.Dataset
            The output `xarray.Dataset` that is encoded from the this grid.

New option:

def encode_as(self, grid_type, coord_type):
coord_type by default is the same as the original grid

if specified as something else, we can transform coordinates internally.

This would use helper functions such as:

node_xyz_to_lonlat_rad

Metadata

Metadata

Assignees

No one assigned

    Labels

    improvementImprovements on existing features or infrastructure

    Type

    No type

    Projects

    Status

    📚 Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions