Skip to content

Commit

Permalink
Fix formatting with pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
xylar committed Feb 21, 2023
1 parent b575f99 commit c54c947
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 35 deletions.
2 changes: 1 addition & 1 deletion compass/ocean/suites/kuroshio12to60.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ ocean/global_ocean/Kuroshio12to60/mesh
ocean/global_ocean/Kuroshio12to60/PHC/init
ocean/global_ocean/Kuroshio12to60/PHC/performance_test
ocean/global_ocean/Kuroshio12to60/PHC/dynamic_adjustment
ocean/global_ocean/Kuroshio12to60/PHC/files_for_e3sm
ocean/global_ocean/Kuroshio12to60/PHC/files_for_e3sm
2 changes: 1 addition & 1 deletion compass/ocean/suites/kuroshio8to60.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ ocean/global_ocean/Kuroshio8to60/mesh
ocean/global_ocean/Kuroshio8to60/PHC/init
ocean/global_ocean/Kuroshio8to60/PHC/performance_test
ocean/global_ocean/Kuroshio8to60/PHC/dynamic_adjustment
ocean/global_ocean/Kuroshio8to60/PHC/files_for_e3sm
ocean/global_ocean/Kuroshio8to60/PHC/files_for_e3sm
2 changes: 1 addition & 1 deletion compass/ocean/tests/global_ocean/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
EC30to60DynamicAdjustment,
)
from compass.ocean.tests.global_ocean.mesh.kuroshio.dynamic_adjustment import (
Kuroshio12to60DynamicAdjustment,
KuroshioDynamicAdjustment,
)
from compass.ocean.tests.global_ocean.mesh.qu240.dynamic_adjustment import (
QU240DynamicAdjustment,
Expand Down
8 changes: 5 additions & 3 deletions compass/ocean/tests/global_ocean/forward.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import os
from importlib.resources import contents

from compass.ocean.tests.global_ocean.metadata import \
add_mesh_and_init_metadata
from compass.model import run_model
from compass.testcase import TestCase
from compass.ocean.tests.global_ocean.metadata import (
add_mesh_and_init_metadata,
)
from compass.step import Step
from compass.testcase import TestCase


class ForwardStep(Step):
Expand Down Expand Up @@ -163,6 +164,7 @@ def _get_resources(self):
self.openmp_threads = config.getint(
'global_ocean', 'forward_threads')


class ForwardTestCase(TestCase):
"""
A parent class for test cases for forward runs with global MPAS-Ocean mesh
Expand Down
4 changes: 2 additions & 2 deletions compass/ocean/tests/global_ocean/init/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os

from compass.testcase import TestCase
from compass.ocean.tests.global_ocean.init.initial_state import InitialState
from compass.ocean.tests.global_ocean.init.ssh_adjustment import SshAdjustment
from compass.testcase import TestCase
from compass.validate import compare_variables


Expand Down Expand Up @@ -116,4 +116,4 @@ def validate(self):
if self.mesh.with_ice_shelf_cavities:
variables = ['ssh', 'landIcePressure']
compare_variables(test_case=self, variables=variables,
filename1='ssh_adjustment/adjusted_init.nc')
filename1='ssh_adjustment/adjusted_init.nc')
17 changes: 10 additions & 7 deletions compass/ocean/tests/global_ocean/mesh/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
from compass.testcase import TestCase
from compass.mesh.spherical import IcosahedralMeshStep, \
QuasiUniformSphericalMeshStep
from compass.mesh.spherical import (
IcosahedralMeshStep,
QuasiUniformSphericalMeshStep,
)
from compass.ocean.mesh.cull import CullMeshStep
from compass.ocean.tests.global_ocean.metadata import \
get_author_and_email_from_git
from compass.ocean.tests.global_ocean.mesh.arrm10to60 import ARRM10to60BaseMesh
from compass.ocean.tests.global_ocean.mesh.ec30to60 import EC30to60BaseMesh
from compass.ocean.tests.global_ocean.mesh.so12to60 import SO12to60BaseMesh
from compass.ocean.tests.global_ocean.mesh.kuroshio import KuroshioBaseMesh
from compass.ocean.tests.global_ocean.mesh.so12to60 import SO12to60BaseMesh
from compass.ocean.tests.global_ocean.mesh.wc14 import WC14BaseMesh
from compass.ocean.tests.global_ocean.metadata import (
get_author_and_email_from_git,
)
from compass.testcase import TestCase
from compass.validate import compare_variables


Expand Down Expand Up @@ -134,4 +137,4 @@ def get_cull_mesh_path(self):
cull_mesh_path : str
The path to the work directory of the cull mesh step.
"""
return self.steps['cull_mesh'].path
return self.steps['cull_mesh'].path
26 changes: 12 additions & 14 deletions compass/ocean/tests/global_ocean/mesh/kuroshio/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import numpy as np

import mpas_tools.mesh.creation.mesh_definition_tools as mdt
from mpas_tools.mesh.creation.signed_distance import \
signed_distance_from_geojson
import numpy as np
from geometric_features import read_feature_collection
from mpas_tools.cime.constants import constants
from mpas_tools.mesh.creation.signed_distance import (
signed_distance_from_geojson,
)

from compass.mesh import QuasiUniformSphericalMeshStep

Expand Down Expand Up @@ -46,8 +46,8 @@ def build_cell_width_lat_lon(self):
dlon = 0.1
dlat = dlon
earth_radius = constants['SHR_CONST_REARTH']
nlon = int(360./dlon) + 1
nlat = int(180./dlat) + 1
nlon = int(360. / dlon) + 1
nlat = int(180. / dlat) + 1
lon = np.linspace(-180., 180., nlon)
lat = np.linspace(-90., 90., nlat)

Expand All @@ -61,8 +61,8 @@ def build_cell_width_lat_lon(self):
fc1 = read_feature_collection('wbc_rectangle3-1.geojson')

ks_signed_distance1 = signed_distance_from_geojson(fc1, lon, lat,
earth_radius,
max_length=0.25)
earth_radius,
max_length=0.25)

trans_width = 400e3
trans_start = 0
Expand All @@ -73,12 +73,11 @@ def build_cell_width_lat_lon(self):

cellWidth = dx_min * (1 - weights) + cellWidth * weights


fc2 = read_feature_collection('wbc_rectangle3-2.geojson')

ks_signed_distance2 = signed_distance_from_geojson(fc2, lon, lat,
earth_radius,
max_length=0.25)
earth_radius,
max_length=0.25)

trans_width = 400e3
trans_start = 0
Expand All @@ -89,12 +88,11 @@ def build_cell_width_lat_lon(self):

cellWidth = dx_min * (1 - weights) + cellWidth * weights


fc3 = read_feature_collection('wbc_rectangle3-3.geojson')

ks_signed_distance3 = signed_distance_from_geojson(fc3, lon, lat,
earth_radius,
max_length=0.25)
earth_radius,
max_length=0.25)

trans_width = 400e3
trans_start = 0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from compass.ocean.tests.global_ocean.dynamic_adjustment import \
DynamicAdjustment
from compass.ocean.tests.global_ocean.dynamic_adjustment import (
DynamicAdjustment,
)
from compass.ocean.tests.global_ocean.forward import ForwardStep


Expand Down Expand Up @@ -188,4 +189,4 @@ def __init__(self, test_group, mesh, init, time_integrator):
step.add_output_file(filename='output.nc')
self.add_step(step)

self.restart_filenames = restart_filenames
self.restart_filenames = restart_filenames
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ mesh_revision = 4
# the maximum (coarsest) resolution in the mesh, can be the same as min_res
max_res = 60
# the URL of the pull request documenting the creation of the mesh
pull_request = https://github.com/MPAS-Dev/compass/pull/525
pull_request = https://github.com/MPAS-Dev/compass/pull/525
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ config_use_GM = .true.
config_GM_closure = 'constant'
config_GM_constant_kappa = 600.0
config_Redi_constant_kappa = 400.0
config_Redi_maximum_slope = 0.01
config_Redi_maximum_slope = 0.01
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ config_use_GM = .true.
config_GM_closure = 'constant'
config_GM_constant_kappa = 600.0
config_Redi_constant_kappa = 400.0
config_Redi_maximum_slope = 0.01
config_Redi_maximum_slope = 0.01

0 comments on commit c54c947

Please sign in to comment.