From c54c94794b7b6534c078940852b84c5ea5b698d5 Mon Sep 17 00:00:00 2001 From: Xylar Asay-Davis Date: Fri, 17 Feb 2023 17:24:24 -0600 Subject: [PATCH] Fix formatting with pre-commit --- compass/ocean/suites/kuroshio12to60.txt | 2 +- compass/ocean/suites/kuroshio8to60.txt | 2 +- compass/ocean/tests/global_ocean/__init__.py | 2 +- compass/ocean/tests/global_ocean/forward.py | 8 +++--- .../ocean/tests/global_ocean/init/__init__.py | 4 +-- .../ocean/tests/global_ocean/mesh/__init__.py | 17 +++++++----- .../global_ocean/mesh/kuroshio/__init__.py | 26 +++++++++---------- .../kuroshio/dynamic_adjustment/__init__.py | 7 ++--- .../global_ocean/mesh/kuroshio/kuroshio.cfg | 2 +- .../kuroshio12to60/namelist.split_explicit | 2 +- .../kuroshio8to60/namelist.split_explicit | 2 +- 11 files changed, 39 insertions(+), 35 deletions(-) diff --git a/compass/ocean/suites/kuroshio12to60.txt b/compass/ocean/suites/kuroshio12to60.txt index 47816f20c4..e986771062 100644 --- a/compass/ocean/suites/kuroshio12to60.txt +++ b/compass/ocean/suites/kuroshio12to60.txt @@ -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 \ No newline at end of file +ocean/global_ocean/Kuroshio12to60/PHC/files_for_e3sm diff --git a/compass/ocean/suites/kuroshio8to60.txt b/compass/ocean/suites/kuroshio8to60.txt index f675c5be73..a6838e0186 100644 --- a/compass/ocean/suites/kuroshio8to60.txt +++ b/compass/ocean/suites/kuroshio8to60.txt @@ -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 \ No newline at end of file +ocean/global_ocean/Kuroshio8to60/PHC/files_for_e3sm diff --git a/compass/ocean/tests/global_ocean/__init__.py b/compass/ocean/tests/global_ocean/__init__.py index a7aceff0d2..5af1438845 100644 --- a/compass/ocean/tests/global_ocean/__init__.py +++ b/compass/ocean/tests/global_ocean/__init__.py @@ -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, diff --git a/compass/ocean/tests/global_ocean/forward.py b/compass/ocean/tests/global_ocean/forward.py index 15cd2079e4..1b6b651b1f 100644 --- a/compass/ocean/tests/global_ocean/forward.py +++ b/compass/ocean/tests/global_ocean/forward.py @@ -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): @@ -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 diff --git a/compass/ocean/tests/global_ocean/init/__init__.py b/compass/ocean/tests/global_ocean/init/__init__.py index 8f30fae7b3..00e00bca6a 100644 --- a/compass/ocean/tests/global_ocean/init/__init__.py +++ b/compass/ocean/tests/global_ocean/init/__init__.py @@ -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 @@ -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') \ No newline at end of file + filename1='ssh_adjustment/adjusted_init.nc') diff --git a/compass/ocean/tests/global_ocean/mesh/__init__.py b/compass/ocean/tests/global_ocean/mesh/__init__.py index e0fd7c4e62..1cd02c9105 100644 --- a/compass/ocean/tests/global_ocean/mesh/__init__.py +++ b/compass/ocean/tests/global_ocean/mesh/__init__.py @@ -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 @@ -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 \ No newline at end of file + return self.steps['cull_mesh'].path diff --git a/compass/ocean/tests/global_ocean/mesh/kuroshio/__init__.py b/compass/ocean/tests/global_ocean/mesh/kuroshio/__init__.py index 9b9893d0d7..17d58861e7 100644 --- a/compass/ocean/tests/global_ocean/mesh/kuroshio/__init__.py +++ b/compass/ocean/tests/global_ocean/mesh/kuroshio/__init__.py @@ -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 @@ -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) @@ -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 @@ -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 @@ -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 diff --git a/compass/ocean/tests/global_ocean/mesh/kuroshio/dynamic_adjustment/__init__.py b/compass/ocean/tests/global_ocean/mesh/kuroshio/dynamic_adjustment/__init__.py index a12be9460b..9d5c31c87c 100644 --- a/compass/ocean/tests/global_ocean/mesh/kuroshio/dynamic_adjustment/__init__.py +++ b/compass/ocean/tests/global_ocean/mesh/kuroshio/dynamic_adjustment/__init__.py @@ -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 @@ -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 \ No newline at end of file + self.restart_filenames = restart_filenames diff --git a/compass/ocean/tests/global_ocean/mesh/kuroshio/kuroshio.cfg b/compass/ocean/tests/global_ocean/mesh/kuroshio/kuroshio.cfg index c387de7f52..cc6157445f 100644 --- a/compass/ocean/tests/global_ocean/mesh/kuroshio/kuroshio.cfg +++ b/compass/ocean/tests/global_ocean/mesh/kuroshio/kuroshio.cfg @@ -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 \ No newline at end of file +pull_request = https://github.com/MPAS-Dev/compass/pull/525 diff --git a/compass/ocean/tests/global_ocean/mesh/kuroshio12to60/namelist.split_explicit b/compass/ocean/tests/global_ocean/mesh/kuroshio12to60/namelist.split_explicit index 2a0d0c9149..669f53aca4 100644 --- a/compass/ocean/tests/global_ocean/mesh/kuroshio12to60/namelist.split_explicit +++ b/compass/ocean/tests/global_ocean/mesh/kuroshio12to60/namelist.split_explicit @@ -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 \ No newline at end of file +config_Redi_maximum_slope = 0.01 diff --git a/compass/ocean/tests/global_ocean/mesh/kuroshio8to60/namelist.split_explicit b/compass/ocean/tests/global_ocean/mesh/kuroshio8to60/namelist.split_explicit index b970153854..a01274a16f 100644 --- a/compass/ocean/tests/global_ocean/mesh/kuroshio8to60/namelist.split_explicit +++ b/compass/ocean/tests/global_ocean/mesh/kuroshio8to60/namelist.split_explicit @@ -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 \ No newline at end of file +config_Redi_maximum_slope = 0.01