Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve attributes when setting desired longitude range #874

Merged
merged 3 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified test/meshfiles/ugrid/quad-hexagon/grid.nc
Binary file not shown.
10 changes: 1 addition & 9 deletions uxarray/conventions/ugrid.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from uxarray.constants import INT_FILL_VALUE, INT_DTYPE
from uxarray.constants import INT_FILL_VALUE

CONVENTIONS_ATTR = "UGRID-v1.0"

Expand Down Expand Up @@ -144,7 +144,6 @@
"long name": "Maps every face to its corner nodes.",
"start_index": 0,
"_FillValue": INT_FILL_VALUE,
"dtype": INT_DTYPE,
}
FACE_NODE_CONNECTIVITY_DIMS = ["n_face", "n_max_face_nodes"]

Expand All @@ -153,7 +152,6 @@
"long name": "Maps every face to its edges.",
"start_index": 0,
"_FillValue": INT_FILL_VALUE,
"dtype": INT_DTYPE,
}
FACE_EDGE_CONNECTIVITY_DIMS = [
"n_face",
Expand All @@ -165,7 +163,6 @@
"long name": "Faces that neighbor each face.",
"start_index": 0,
"_FillValue": INT_FILL_VALUE,
"dtype": INT_DTYPE,
}
FACE_FACE_CONNECTIVITY_DIMS = [
"n_face",
Expand All @@ -177,7 +174,6 @@
"cf_role": "edge_node_connectivity",
"long name": "Maps every edge to the two nodes that it connects.",
"start_index": 0,
"dtype": INT_DTYPE,
}
EDGE_NODE_CONNECTIVITY_DIMS = ["n_edge", "two"]

Expand All @@ -198,7 +194,6 @@
"long name": "Faces that neighbor each edge",
"start_index": 0,
"_FillValue": INT_FILL_VALUE,
"dtype": INT_DTYPE,
}
EDGE_FACE_CONNECTIVITY_DIMS = ["n_edge", "two"]

Expand All @@ -208,7 +203,6 @@
"long name": "Edges that neighbor each node",
"start_index": 0,
"_FillValue": INT_FILL_VALUE,
"dtype": INT_DTYPE,
}

NODE_EDGE_CONNECTIVITY_DIMS = ["n_node", "n_max_node_edges"]
Expand All @@ -218,7 +212,6 @@
"long name": "Faces that neighbor each node",
"start_index": 0,
"_FillValue": INT_FILL_VALUE,
"dtype": INT_DTYPE,
}

NODE_FACE_CONNECTIVITY_DIMS = ["n_node", "n_max_node_faces"]
Expand All @@ -227,7 +220,6 @@
N_NODES_PER_FACE_ATTRS = {
"cf_role": "n_nodes_per_face",
"long name": "Number of nodes per face",
"dtype": INT_DTYPE,
}

N_NODES_PER_FACE_DIMS = ["n_face"]
Expand Down
2 changes: 1 addition & 1 deletion uxarray/grid/coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,4 +330,4 @@ def _set_desired_longitude_range(ds):
for lon_name in ["node_lon", "edge_lon", "face_lon"]:
if lon_name in ds:
if ds[lon_name].max() > 180:
ds[lon_name] = (ds[lon_name] + 180) % 360 - 180
ds[lon_name].data = (ds[lon_name].data + 180) % 360 - 180
Loading