diff --git a/uxarray/grid/grid.py b/uxarray/grid/grid.py index 19af424a5..b075d7cac 100644 --- a/uxarray/grid/grid.py +++ b/uxarray/grid/grid.py @@ -273,7 +273,6 @@ def parsed_attrs(self) -> dict: """Dictionary of parsed attributes from the source grid.""" return self._ds.attrs - # TODO: deprecate @property def Mesh2(self) -> xr.DataArray: """UGRID Attribute ``Mesh2``, which indicates the topology data of a 2D diff --git a/uxarray/io/_mpas.py b/uxarray/io/_mpas.py index 26b05aadd..7af1823e3 100644 --- a/uxarray/io/_mpas.py +++ b/uxarray/io/_mpas.py @@ -396,10 +396,9 @@ def _read_mpas(ext_ds, use_dual=False): # convert dual-mesh to UGRID if use_dual: - ugrid_mapping = _dual_to_ugrid(ext_ds, ds) + source_dim_map = _dual_to_ugrid(ext_ds, ds) # convert primal-mesh to UGRID else: - ugrid_mapping = _primal_to_ugrid(ext_ds, ds) + source_dim_map = _primal_to_ugrid(ext_ds, ds) - # TODO: Return Original Variable Mapping to UGRID - return ds, ugrid_mapping + return ds, source_dim_map diff --git a/uxarray/io/_scrip.py b/uxarray/io/_scrip.py index 47cff6dff..ca52c4e76 100644 --- a/uxarray/io/_scrip.py +++ b/uxarray/io/_scrip.py @@ -127,7 +127,7 @@ def _read_scrip(ext_ds): try: # If not ugrid compliant, translates scrip to ugrid conventions - unq_inv = _to_ugrid(ext_ds, ds) + source_dims_dict = _to_ugrid(ext_ds, ds) # Add necessary UGRID attributes to new dataset ds["Mesh2"] = xr.DataArray( @@ -146,8 +146,8 @@ def _read_scrip(ext_ds): "Variables not in recognized SCRIP form. Please refer to", "https://earthsystemmodeling.org/docs/release/ESMF_6_2_0/ESMF_refdoc/node3.html#SECTION03024000000000000000", "for more information on SCRIP Grid file formatting") - # TODO: Original Variable Names - return ds, unq_inv + + return ds, source_dims_dict def _encode_scrip(mesh2_face_nodes, mesh2_node_x, mesh2_node_y, face_areas): diff --git a/uxarray/io/_ugrid.py b/uxarray/io/_ugrid.py index c18e43632..97d04d526 100644 --- a/uxarray/io/_ugrid.py +++ b/uxarray/io/_ugrid.py @@ -13,16 +13,13 @@ def _read_ugrid(xr_ds): """ source_dims_dict = {} - - # TODO: Standardized UGRID Variable Names (Mesh2_node_x, etc) - # TODO: obtain and change to Mesh2 construct, see Issue #27 # get the data variable name that has attribute "cf_role" set to "mesh_topology" # this is the base xarray.DataArray name base_xarray_var = list( xr_ds.filter_by_attrs(cf_role="mesh_topology").keys())[0] - # TODO: Dataset includes more than just coordinates and face nodes, handle + # TODO: Allow for parsing datasets with more than just coordinates and face nodes xr_ds = xr_ds.rename({base_xarray_var: "Mesh2"}) @@ -50,14 +47,15 @@ def _read_ugrid(xr_ds): xr_ds["Mesh2_face_nodes"].dims[1]: "nMaxMesh2_face_nodes" }) - if len(coord_names) == 2: - # set coordinates - xr_ds = xr_ds.set_coords(["Mesh2_node_x", "Mesh2_node_y"]) - else: - xr_ds = xr_ds.set_coords( - [["Mesh2_node_x", "Mesh2_node_y", - "Mesh2_node_z"] # TODO: remove Mesh2_node_z - ]) + xr_ds = xr_ds.set_coords(["Mesh2_node_x", "Mesh2_node_y"]) + # if len(coord_names) == 2: + # # set coordinates + # xr_ds = xr_ds.set_coords(["Mesh2_node_x", "Mesh2_node_y"]) + # else: + # xr_ds = xr_ds.set_coords( + # [["Mesh2_node_x", "Mesh2_node_y", + # "Mesh2_node_z"] # TODO: remove Mesh2_node_z + # ]) # standardize fill values and data type for face nodes xr_ds = _standardize_fill_values(xr_ds)