Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Dougie Squire <[email protected]>
  • Loading branch information
anton-seaice and dougiesquire authored Apr 16, 2024
1 parent a93cdbb commit 9e92bd7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![Code Health](https://github.com/COSIMA/esmgrids/actions/workflows/ci.yml/badge.svg)
![Tests](https://github.com/COSIMA/esmgrids/actions/workflows/ci.yml/badge.svg)

# esmgrids

Expand Down
22 changes: 11 additions & 11 deletions esmgrids/cice_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def fromfile(cls, h_grid_def, mask_file=None, description="CICE tripolar"):
description=description,
)

def create_2d_nc_var(self, nc, name):
def _create_2d_nc_var(self, nc, name):
# set chunksizes based on OM2 config
# To-do: load these from a configuration file?
if self.num_lon_points == 360: # 1deg
Expand Down Expand Up @@ -117,54 +117,54 @@ def write(self, nc):
# names are based on https://cfconventions.org/Data/cf-standard-names/current/build/cf-standard-name-table.html
nc.Conventions = "CF-1.6"

ulat = self.create_2d_nc_var(nc, "ulat")
ulat = self._create_2d_nc_var(nc, "ulat")
ulat.units = "radians"
ulat.long_name = "Latitude of U points"
ulat.standard_name = "latitude"
ulon = self.create_2d_nc_var(nc, "ulon")
ulon = self._create_2d_nc_var(nc, "ulon")
ulon.units = "radians"
ulon.long_name = "Longitude of U points"
ulon.standard_name = "longitude"
tlat = self.create_2d_nc_var(nc, "tlat")
tlat = self._create_2d_nc_var(nc, "tlat")
tlat.units = "radians"
tlat.long_name = "Latitude of T points"
tlat.standard_name = "latitude"
tlon = self.create_2d_nc_var(nc, "tlon")
tlon = self._create_2d_nc_var(nc, "tlon")
tlon.units = "radians"
tlon.long_name = "Longitude of T points"
tlon.standard_name = "longitude"

htn = self.create_2d_nc_var(nc, "htn")
htn = self._create_2d_nc_var(nc, "htn")
htn.units = "cm"
htn.long_name = "Width of T cells on North side."
htn.coordinates = "ulat tlon"
htn.grid_mapping = "crs"
hte = self.create_2d_nc_var(nc, "hte")
hte = self._create_2d_nc_var(nc, "hte")
hte.units = "cm"
hte.long_name = "Width of T cells on East side."
hte.coordinates = "tlat ulon"
hte.grid_mapping = "crs"

angle = self.create_2d_nc_var(nc, "angle")
angle = self._create_2d_nc_var(nc, "angle")
angle.units = "radians"
angle.long_name = "Rotation angle of U cells."
angle.standard_name = "angle_of_rotation_from_east_to_x"
angle.coordinates = "ulat ulon"
angle.grid_mapping = "crs"
angleT = self.create_2d_nc_var(nc, "angleT")
angleT = self._create_2d_nc_var(nc, "angleT")
angleT.units = "radians"
angleT.long_name = "Rotation angle of T cells."
angleT.standard_name = "angle_of_rotation_from_east_to_x"
angleT.coordinates = "tlat tlon"
angleT.grid_mapping = "crs"

area_t = self.create_2d_nc_var(nc, "tarea")
area_t = self._create_2d_nc_var(nc, "tarea")
area_t.units = "m^2"
area_t.long_name = "Area of T cells."
area_t.standard_name = "cell_area"
area_t.coordinates = "tlat tlon"
area_t.grid_mapping = "crs"
area_u = self.create_2d_nc_var(nc, "uarea")
area_u = self._create_2d_nc_var(nc, "uarea")
area_u.units = "m^2"
area_u.long_name = "Area of U cells."
area_u.standard_name = "cell_area"
Expand Down
2 changes: 1 addition & 1 deletion test/test_cice_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
_test_resolutions = [4, 0.1]


# so that our fixtures are only create once in this pytest module, we need this special version of 'tmp_path'
# so that our fixtures are only created once in this pytest module, we need this special version of 'tmp_path'
@pytest.fixture(scope="module")
def tmp_path(tmp_path_factory: pytest.TempdirFactory) -> Path:
return tmp_path_factory.mktemp("temp")
Expand Down

0 comments on commit 9e92bd7

Please sign in to comment.