Skip to content

Commit

Permalink
Norman's review addressed 2
Browse files Browse the repository at this point in the history
  • Loading branch information
konstntokas committed Jan 16, 2025
1 parent 808021d commit 2855d91
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions xcube/core/gridmapping/cfconv.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def get_dataset_grid_mapping_proxies(
grid_mapping_proxies: dict[Union[Hashable, None], GridMappingProxy] = dict()

# Find any grid mapping variables by CF 'grid_mapping' attribute
#
for var_name, var in dataset.variables.items():
grid_mapping_var_name = var.attrs.get("grid_mapping")
if (
Expand All @@ -85,6 +86,7 @@ def get_dataset_grid_mapping_proxies(

# If no grid mapping variables found,
# try if CRS is encoded in some variable's attributes
#
if not grid_mapping_proxies:
for var_name, var in dataset.variables.items():
gmp = _parse_crs_from_attrs(var.attrs)
Expand All @@ -94,19 +96,22 @@ def get_dataset_grid_mapping_proxies(

# If no grid mapping variables found,
# try if CRS is encoded in dataset attributes
#
if not grid_mapping_proxies:
gmp = _parse_crs_from_attrs(dataset.attrs)
if gmp is not None:
grid_mapping_proxies[None] = gmp

# Find coordinate variables.
#
latitude_longitude_coords = GridCoords()
rotated_latitude_longitude_coords = GridCoords()
projected_coords = GridCoords()

potential_coord_vars = _find_potential_coord_vars(dataset)

# Find coordinate variables that use a CF standard_name.
#
coords_standard_names = (
(latitude_longitude_coords, "longitude", "latitude"),
(rotated_latitude_longitude_coords, "grid_longitude", "grid_latitude"),
Expand All @@ -124,6 +129,7 @@ def get_dataset_grid_mapping_proxies(
coords.y = var

# Find coordinate variables by common naming convention.
#
coords_var_names = (
(latitude_longitude_coords, ("lon", "longitude"), ("lat", "latitude")),
(
Expand Down

0 comments on commit 2855d91

Please sign in to comment.