Skip to content

Commit

Permalink
black reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
alperaltuntas committed Jan 6, 2025
1 parent bbda1b9 commit 9665892
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions regional_mom6/regional_mom6.py
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,9 @@ def __init__(
raise ValueError
else:
if hgrid_path:
raise ValueError("hgrid_path can only be set if hgrid_type is 'from_file'.")
raise ValueError(
"hgrid_path can only be set if hgrid_type is 'from_file'."
)
self.longitude_extent = tuple(longitude_extent)
self.latitude_extent = tuple(latitude_extent)
self.hgrid = self._make_hgrid()
Expand All @@ -742,7 +744,9 @@ def __init__(
self.vgrid = self._make_vgrid(vgrid_from_file.dz.data)
else:
if vgrid_path:
raise ValueError("vgrid_path can only be set if vgrid_type is 'from_file'.")
raise ValueError(
"vgrid_path can only be set if vgrid_type is 'from_file'."
)
self.vgrid = self._make_vgrid()

self.segments = {}
Expand Down Expand Up @@ -1885,7 +1889,9 @@ def setup_bathymetry(
bathymetry_output.depth.attrs["coordinates"] = "lon lat"
if write_to_file:
bathymetry_output.to_netcdf(
self.mom_input_dir / "bathymetry_original.nc", mode="w", engine="netcdf4"
self.mom_input_dir / "bathymetry_original.nc",
mode="w",
engine="netcdf4",
)

tgrid = xr.Dataset(
Expand Down Expand Up @@ -1924,7 +1930,9 @@ def setup_bathymetry(
tgrid.depth.attrs["coordinates"] = "lon lat"
if write_to_file:
tgrid.to_netcdf(
self.mom_input_dir / "bathymetry_unfinished.nc", mode="w", engine="netcdf4"
self.mom_input_dir / "bathymetry_unfinished.nc",
mode="w",
engine="netcdf4",
)
tgrid.close()

Expand All @@ -1945,7 +1953,9 @@ def setup_bathymetry(
bathymetry = regridder(bathymetry_output)
if write_to_file:
bathymetry.to_netcdf(
self.mom_input_dir / "bathymetry_unfinished.nc", mode="w", engine="netcdf4"
self.mom_input_dir / "bathymetry_unfinished.nc",
mode="w",
engine="netcdf4",
)
print(
"Regridding successful! Now calling `tidy_bathymetry` method for some finishing touches..."
Expand All @@ -1957,7 +1967,11 @@ def setup_bathymetry(
return bathymetry

def tidy_bathymetry(
self, fill_channels=False, positive_down=False, vertical_coordinate_name="depth", bathymetry=None
self,
fill_channels=False,
positive_down=False,
vertical_coordinate_name="depth",
bathymetry=None,
):
"""
An auxiliary function for bathymetry used to fix up the metadata and remove inland
Expand Down

0 comments on commit 9665892

Please sign in to comment.