Skip to content

Support projection coordinates in _read_ugrid #901

Description

@kjnam

Proposed new feature or change:

The current _read_ugrid assumes the coordinate values are in longitude and latitude. and this not always true.

def _read_ugrid(ds):
"""Parses an unstructured grid dataset and encodes it in the UGRID
conventions."""
# Grid Topology
grid_topology_name = list(ds.filter_by_attrs(cf_role="mesh_topology").keys())[0]
ds = ds.rename({grid_topology_name: "grid_topology"})
# Coordinates
# get the names of node_lon and node_lat
node_lon_name, node_lat_name = ds["grid_topology"].node_coordinates.split()
coord_dict = {
node_lon_name: ugrid.NODE_COORDINATES[0],
node_lat_name: ugrid.NODE_COORDINATES[1],
}

The coordinates can be projected ones. So, I think it is better to rename coordinate variables only when the standard names of those are "longitude" and "latitude" following the CF convention.
This behavior can be added easily without disturbing the current approach.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    new featureNew user-facing functionality

    Type

    No type

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions