diff --git a/.github/workflows/gis_coarse_meshgen.yml b/.github/workflows/gis_coarse_meshgen.yml index 374fd56728..a1ce161d3d 100644 --- a/.github/workflows/gis_coarse_meshgen.yml +++ b/.github/workflows/gis_coarse_meshgen.yml @@ -8,8 +8,8 @@ on: - compass/landice/tests/greenland/mesh.py jobs: - setup_and_run_job: - name: setup_and_run_job + gis-coarse-meshgen: + name: GIS Coarse Mesh Generation runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -23,10 +23,10 @@ jobs: pushd compass # create the compass environment - ./conda/configure_compass_env.py --conda $root/mambaForge --mpi mpich + ./conda/configure_compass_env.py --conda $root/mambaForge --env_name compass_test --mpi mpich # enable the compass environment - source load_dev_compass_1.7.0-alpha.1_mpich.sh + source load_compass_test_mpich.sh popd diff --git a/compass/landice/mesh.py b/compass/landice/mesh.py index 28ea3c40ef..182ae2fcce 100644 --- a/compass/landice/mesh.py +++ b/compass/landice/mesh.py @@ -688,14 +688,14 @@ def build_mali_mesh(self, cell_width, x1, y1, geom_points, logger.info('writing grid_converted.nc') write_netcdf(dsMesh, 'grid_converted.nc') levels = section.get('levels') - args = ['create_landice_grid_from_generic_MPAS_grid.py', + args = ['create_landice_grid_from_generic_mpas_grid', '-i', 'grid_converted.nc', '-o', 'grid_preCull.nc', '-l', levels, '-v', 'glimmer'] check_call(args, logger=logger) - args = ['interpolate_to_mpasli_grid.py', '-s', + args = ['interpolate_to_mpasli_grid', '-s', gridded_dataset, '-d', 'grid_preCull.nc', '-m', 'b', '-t'] @@ -703,7 +703,7 @@ def build_mali_mesh(self, cell_width, x1, y1, geom_points, cullDistance = section.get('cull_distance') if float(cullDistance) > 0.: - args = ['define_cullMask.py', '-f', + args = ['define_landice_cull_mask', '-f', 'grid_preCull.nc', '-m', 'distance', '-d', cullDistance] @@ -715,7 +715,7 @@ def build_mali_mesh(self, cell_width, x1, y1, geom_points, if geojson_file is not None: # This step is only necessary because the GeoJSON region # is defined by lat-lon. - args = ['set_lat_lon_fields_in_planar_grid.py', '-f', + args = ['set_lat_lon_fields_in_planar_grid', '-f', 'grid_preCull.nc', '-p', projection] check_call(args, logger=logger) @@ -742,7 +742,7 @@ def build_mali_mesh(self, cell_width, x1, y1, geom_points, write_netcdf(dsMesh, 'culled.nc') logger.info('Marking horns for culling') - args = ['mark_horns_for_culling.py', '-f', 'culled.nc'] + args = ['mark_horns_for_culling', '-f', 'culled.nc'] check_call(args, logger=logger) @@ -753,24 +753,24 @@ def build_mali_mesh(self, cell_width, x1, y1, geom_points, dsMesh = sort_mesh(dsMesh) write_netcdf(dsMesh, 'dehorned.nc') - args = ['create_landice_grid_from_generic_MPAS_grid.py', '-i', + args = ['create_landice_grid_from_generic_mpas_grid', '-i', 'dehorned.nc', '-o', mesh_name, '-l', levels, '-v', 'glimmer', '--beta', '--thermal', '--obs', '--diri'] check_call(args, logger=logger) - args = ['interpolate_to_mpasli_grid.py', '-s', + args = ['interpolate_to_mpasli_grid', '-s', gridded_dataset, '-d', mesh_name, '-m', 'b'] check_call(args, logger=logger) logger.info('Marking domain boundaries dirichlet') - args = ['mark_domain_boundaries_dirichlet.py', + args = ['mark_domain_boundaries_dirichlet', '-f', mesh_name] check_call(args, logger=logger) - args = ['set_lat_lon_fields_in_planar_grid.py', '-f', + args = ['set_lat_lon_fields_in_planar_grid', '-f', mesh_name, '-p', projection] check_call(args, logger=logger) @@ -1064,7 +1064,7 @@ def __guess_scrip_name(filename): logger.info('creating scrip file for source dataset') # Note: writing scrip file to workdir - args = ['create_SCRIP_file_from_planar_rectangular_grid.py', + args = ['create_scrip_file_from_planar_rectangular_grid', '-i', source_file, '-s', source_scrip, '-p', proj, @@ -1083,8 +1083,8 @@ def __guess_scrip_name(filename): check_call(args, logger=logger) # Perform actual interpolation using the weights - logger.info('calling interpolate_to_mpasli_grid.py') - args = ['interpolate_to_mpasli_grid.py', + logger.info('calling interpolate_to_mpasli_grid') + args = ['interpolate_to_mpasli_grid', '-s', source_file, '-d', dest_file, '-m', 'e', diff --git a/compass/landice/tests/antarctica/mesh.py b/compass/landice/tests/antarctica/mesh.py index 38e7fb23bf..57a8d82b39 100644 --- a/compass/landice/tests/antarctica/mesh.py +++ b/compass/landice/tests/antarctica/mesh.py @@ -121,8 +121,8 @@ def run(self): # Also, it should be assessed if bilinear or # barycentric used here is preferred for this application. # Current thinking is they are both equally appropriate. - logger.info('calling interpolate_to_mpasli_grid.py') - args = ['interpolate_to_mpasli_grid.py', '-s', + logger.info('calling interpolate_to_mpasli_grid') + args = ['interpolate_to_mpasli_grid', '-s', preprocessed_gridded_dataset, '-d', self.mesh_filename, diff --git a/compass/landice/tests/antarctica/mesh_gen/mesh_gen.cfg b/compass/landice/tests/antarctica/mesh_gen/mesh_gen.cfg index 74cbae28c0..cca24f5acd 100644 --- a/compass/landice/tests/antarctica/mesh_gen/mesh_gen.cfg +++ b/compass/landice/tests/antarctica/mesh_gen/mesh_gen.cfg @@ -61,7 +61,7 @@ bedmachine_filename = BedMachineAntarctica_2020-07-15_v02_edits_floodFill_extrap measures_filename = antarctica_ice_velocity_450m_v2_edits_extrap.nc # projection of the source datasets, according to the dictionary keys -# create_SCRIP_file_from_planar_rectangular_grid.py from MPAS_Tools +# create_scrip_file_from_planar_rectangular_grid from MPAS_Tools src_proj = ais-bedmap2 # number of processors to use for ESMF_RegridWeightGen diff --git a/compass/landice/tests/circular_shelf/setup_mesh.py b/compass/landice/tests/circular_shelf/setup_mesh.py index a678e0f784..3a2eadb66e 100644 --- a/compass/landice/tests/circular_shelf/setup_mesh.py +++ b/compass/landice/tests/circular_shelf/setup_mesh.py @@ -1,10 +1,9 @@ import numpy -from netCDF4 import Dataset as NetCDFFile - -from mpas_tools.planar_hex import make_planar_hex_mesh from mpas_tools.io import write_netcdf -from mpas_tools.mesh.conversion import convert, cull from mpas_tools.logging import check_call +from mpas_tools.mesh.conversion import convert, cull +from mpas_tools.planar_hex import make_planar_hex_mesh +from netCDF4 import Dataset as NetCDFFile from compass.model import make_graph_file from compass.step import Step @@ -60,7 +59,7 @@ def run(self): write_netcdf(dsMesh, 'mpas_grid.nc') levels = section.get('levels') - args = ['create_landice_grid_from_generic_MPAS_grid.py', + args = ['create_landice_grid_from_generic_mpas_grid', '-i', 'mpas_grid.nc', '-o', 'landice_grid.nc', '-l', levels, diff --git a/compass/landice/tests/dome/setup_mesh.py b/compass/landice/tests/dome/setup_mesh.py index 912cf3dac8..8eb3c2e34d 100644 --- a/compass/landice/tests/dome/setup_mesh.py +++ b/compass/landice/tests/dome/setup_mesh.py @@ -1,10 +1,9 @@ import numpy -from netCDF4 import Dataset as NetCDFFile - -from mpas_tools.planar_hex import make_planar_hex_mesh from mpas_tools.io import write_netcdf -from mpas_tools.mesh.conversion import convert, cull from mpas_tools.logging import check_call +from mpas_tools.mesh.conversion import convert, cull +from mpas_tools.planar_hex import make_planar_hex_mesh +from netCDF4 import Dataset as NetCDFFile from compass.model import make_graph_file from compass.step import Step @@ -71,7 +70,7 @@ def run(self): write_netcdf(dsMesh, 'mpas_grid.nc') levels = section.get('levels') - args = ['create_landice_grid_from_generic_MPAS_grid.py', + args = ['create_landice_grid_from_generic_mpas_grid', '-i', 'mpas_grid.nc', '-o', 'landice_grid.nc', '-l', levels] @@ -158,7 +157,7 @@ def _setup_dome_initial_conditions(config, logger, filename): thickness_field[r < r0] = h0 * (1.0 - (r[r < r0] / r0) ** 2) ** 0.5 elif dome_type == 'halfar': thickness_field[r < r0] = h0 * ( - 1.0 - (r[r < r0] / r0) ** (4.0 / 3.0)) ** (3.0 / 7.0) + 1.0 - (r[r < r0] / r0) ** (4.0 / 3.0)) ** (3.0 / 7.0) else: raise ValueError('Unexpected dome_type: {}'.format(dome_type)) thickness[0, :] = thickness_field diff --git a/compass/landice/tests/eismint2/setup_mesh.py b/compass/landice/tests/eismint2/setup_mesh.py index d3fb7d635e..088b9a95a2 100644 --- a/compass/landice/tests/eismint2/setup_mesh.py +++ b/compass/landice/tests/eismint2/setup_mesh.py @@ -1,9 +1,8 @@ import xarray - -from mpas_tools.planar_hex import make_planar_hex_mesh from mpas_tools.io import write_netcdf -from mpas_tools.mesh.conversion import convert, cull from mpas_tools.logging import check_call +from mpas_tools.mesh.conversion import convert, cull +from mpas_tools.planar_hex import make_planar_hex_mesh from compass.model import make_graph_file from compass.step import Step @@ -48,7 +47,7 @@ def run(self): dsMesh.close() radius = section.get('radius') - args = ['define_cullMask.py', + args = ['define_landice_cull_mask', '-f', 'mpas_grid.nc', '-m', 'radius', '-d', radius] @@ -61,7 +60,7 @@ def run(self): write_netcdf(dsMesh, 'mpas_grid2.nc') levels = section.get('levels') - args = ['create_landice_grid_from_generic_MPAS_grid.py', + args = ['create_landice_grid_from_generic_mpas_grid', '-i', 'mpas_grid2.nc', '-o', 'landice_grid.nc', '-l', levels, diff --git a/compass/landice/tests/enthalpy_benchmark/setup_mesh.py b/compass/landice/tests/enthalpy_benchmark/setup_mesh.py index 16e0ae81d5..313a1b8b92 100644 --- a/compass/landice/tests/enthalpy_benchmark/setup_mesh.py +++ b/compass/landice/tests/enthalpy_benchmark/setup_mesh.py @@ -1,9 +1,8 @@ -from netCDF4 import Dataset as NetCDFFile - -from mpas_tools.planar_hex import make_planar_hex_mesh from mpas_tools.io import write_netcdf -from mpas_tools.mesh.conversion import convert, cull from mpas_tools.logging import check_call +from mpas_tools.mesh.conversion import convert, cull +from mpas_tools.planar_hex import make_planar_hex_mesh +from netCDF4 import Dataset as NetCDFFile from compass.model import make_graph_file from compass.step import Step @@ -49,7 +48,7 @@ def run(self): dsMesh = convert(dsMesh, logger=logger) write_netcdf(dsMesh, 'mpas_grid.nc') - args = ['create_landice_grid_from_generic_MPAS_grid.py', + args = ['create_landice_grid_from_generic_mpas_grid', '-i', 'mpas_grid.nc', '-o', 'landice_grid.nc', '-l', levels, diff --git a/compass/landice/tests/greenland/mesh_gen/mesh_gen.cfg b/compass/landice/tests/greenland/mesh_gen/mesh_gen.cfg index a285a1cb7c..4cb6417f6c 100644 --- a/compass/landice/tests/greenland/mesh_gen/mesh_gen.cfg +++ b/compass/landice/tests/greenland/mesh_gen/mesh_gen.cfg @@ -62,7 +62,7 @@ bedmachine_filename = BedMachineGreenland-v5_edits_floodFill_extrap.nc measures_filename = greenland_vel_mosaic500_extrap.nc # projection of the source datasets, according to the dictionary keys -# create_SCRIP_file_from_planar_rectangular_grid.py from MPAS_Tools +# create_scrip_file_from_planar_rectangular_grid from MPAS_Tools src_proj = gis-gimp # number of processors to use for ESMF_RegridWeightGen diff --git a/compass/landice/tests/hydro_radial/setup_mesh.py b/compass/landice/tests/hydro_radial/setup_mesh.py index 1d0b6e4c67..b1c12d6d3c 100644 --- a/compass/landice/tests/hydro_radial/setup_mesh.py +++ b/compass/landice/tests/hydro_radial/setup_mesh.py @@ -1,10 +1,9 @@ import numpy as np -from netCDF4 import Dataset as NetCDFFile - -from mpas_tools.planar_hex import make_planar_hex_mesh from mpas_tools.io import write_netcdf -from mpas_tools.mesh.conversion import convert, cull from mpas_tools.logging import check_call +from mpas_tools.mesh.conversion import convert, cull +from mpas_tools.planar_hex import make_planar_hex_mesh +from netCDF4 import Dataset as NetCDFFile from compass.model import make_graph_file from compass.step import Step @@ -72,7 +71,7 @@ def run(self): write_netcdf(dsMesh, 'mpas_grid.nc') levels = section.get('levels') - args = ['create_landice_grid_from_generic_MPAS_grid.py', + args = ['create_landice_grid_from_generic_mpas_grid', '-i', 'mpas_grid.nc', '-o', 'landice_grid.nc', '-l', levels, diff --git a/compass/landice/tests/ismip6_forcing/create_mapfile.py b/compass/landice/tests/ismip6_forcing/create_mapfile.py index 2f96266866..4348807ab9 100644 --- a/compass/landice/tests/ismip6_forcing/create_mapfile.py +++ b/compass/landice/tests/ismip6_forcing/create_mapfile.py @@ -1,15 +1,12 @@ import os import shutil -import netCDF4 +import numpy as np import xarray as xr from mpas_tools.logging import check_call from mpas_tools.scrip.from_mpas import scrip_from_mpas -from pyremap.descriptor.utility import ( - create_scrip, - interp_extrap_corners_2d, - unwrap_corners, -) +from pyremap.descriptor.utility import interp_extrap_corners_2d, unwrap_corners +from pyremap.utility import write_netcdf def build_mapping_file(config, cores, logger, ismip6_grid_file, mapping_file, @@ -73,7 +70,7 @@ def build_mapping_file(config, cores, logger, ismip6_grid_file, mapping_file, if scrip_from_latlon: create_scrip_from_latlon(ismip6_grid_file, source_grid_scripfile) else: - args = ["create_SCRIP_file_from_planar_rectangular_grid.py", + args = ["create_scrip_file_from_planar_rectangular_grid", "--input", ismip6_grid_file, "--scrip", source_grid_scripfile, "--proj", ismip6_projection, @@ -89,7 +86,7 @@ def build_mapping_file(config, cores, logger, ismip6_grid_file, mapping_file, mali_mesh_copy = f"{mali_mesh_file}_copy" shutil.copy(mali_mesh_file, f"{mali_mesh_file}_copy") - args = ["set_lat_lon_fields_in_planar_grid.py", + args = ["set_lat_lon_fields_in_planar_grid", "--file", mali_mesh_copy, "--proj", ismip6_projection] @@ -106,9 +103,9 @@ def build_mapping_file(config, cores, logger, ismip6_grid_file, mapping_file, "--method. Available options are 'bilinear'," "'neareststod', 'conserve'.") - parallel_executable = config.get('parallel', 'parallel_executable') + parallel_executable = config.get("parallel", "parallel_executable") # split the parallel executable into constituents in case it includes flags - args = parallel_executable.split(' ') + args = parallel_executable.split(" ") args.extend(["-n", f"{cores}", "ESMF_RegridWeightGen", "-s", source_grid_scripfile, @@ -133,7 +130,7 @@ def create_scrip_from_latlon(source_grid_file, source_grid_scripfile): dataset. This function is needed, c.f. the scrip utility in the MPAS-Tools repo - (i.e. `create_SCRIP_file_from_planar_rectangular_grid.py`), when a dataset + (i.e. `create_scrip_file_from_planar_rectangular_grid`), when a dataset does not have `x`/`y` coordinates to generate the scrip file from. This is the case for the atmospheric forcing datasets from ISMIP6 and for RACMO products. @@ -148,7 +145,7 @@ def create_scrip_from_latlon(source_grid_file, source_grid_scripfile): """ ds = xr.open_dataset(source_grid_file) - out_file = netCDF4.Dataset(source_grid_scripfile, 'w') + ds_out = xr.Dataset() # RACMO datasets, which use a rotated-pole grid, do not contain `x`/`y` # dimensions, instead use `rlat`/`rlon` dimensions to find `nx`/`ny` @@ -161,15 +158,13 @@ def create_scrip_from_latlon(source_grid_file, source_grid_scripfile): grid_size = nx * ny - # generate common variables used in scrip files - create_scrip(out_file, grid_size, grid_corners=4, grid_rank=2, - units="degrees", meshName=source_grid_file) - # place the information from our source dataset into the scrip dataset - out_file.variables["grid_center_lat"][:] = ds.lat.values.flat - out_file.variables["grid_center_lon"][:] = ds.lon.values.flat - out_file.variables["grid_dims"][:] = [nx, ny] - out_file.variables["grid_imask"][:] = 1 + ds_out["grid_center_lat"] = (("grid_size",), ds.lat.values.flat) + ds_out["grid_center_lon"] = (("grid_size",), ds.lon.values.flat) + ds_out["grid_dims"] = (("grid_rank",), [nx, ny]) + ds_out["grid_imask"] = xr.DataArray( + np.ones(ds.sizes["grid_size"], dtype="int32"), dims=("grid_size",) + ) # determine the corners of gricells if "lat_bnds" in ds and "lon_bnds" in ds: @@ -193,7 +188,18 @@ def create_scrip_from_latlon(source_grid_file, source_grid_scripfile): grid_corner_lat = lat_corner.reshape((grid_size, 4)) grid_corner_lon = lon_corner.reshape((grid_size, 4)) - out_file.variables["grid_corner_lat"][:] = grid_corner_lat - out_file.variables["grid_corner_lon"][:] = grid_corner_lon - - out_file.close() + ds_out["grid_corner_lat"] = ( + ("grid_size", "grid_corners"), grid_corner_lat + ) + ds_out["grid_corner_lon"] = ( + ("grid_size", "grid_corners"), grid_corner_lon + ) + + ds.grid_center_lat.attrs["units"] = "degrees" + ds.grid_center_lon.attrs["units"] = "degrees" + ds.grid_corner_lat.attrs["units"] = "degrees" + ds.grid_corner_lon.attrs["units"] = "degrees" + ds.grid_imask.attrs["units"] = "unitless" + + ds.attrs["mesh_name"] = source_grid_file + write_netcdf(ds, source_grid_scripfile, format="NETCDF3_64BIT") diff --git a/compass/landice/tests/ismip6_run/ismip6_ais_proj2300/create_slm_mapping_files.py b/compass/landice/tests/ismip6_run/ismip6_ais_proj2300/create_slm_mapping_files.py index 10933d2d8b..e94928535c 100644 --- a/compass/landice/tests/ismip6_run/ismip6_ais_proj2300/create_slm_mapping_files.py +++ b/compass/landice/tests/ismip6_run/ismip6_ais_proj2300/create_slm_mapping_files.py @@ -73,14 +73,14 @@ def _build_mapping_files(self, config, logger): args = ['ncremap', '-g', slm_scripfile, '-G', - f'latlon={nglv},{2*int(nglv)}#lat_typ=gss#lat_drc=n2s'] + f'latlon={nglv},{2 * int(nglv)}#lat_typ=gss#lat_drc=n2s'] check_call(args, logger=logger) # mali scripfile # first have to adjust lat-lon values as if they are on sphere shutil.copy(init_cond_path, mali_meshfile) - args = ['set_lat_lon_fields_in_planar_grid.py', + args = ['set_lat_lon_fields_in_planar_grid', '--file', mali_meshfile, '--proj', 'ais-bedmap2-sphere'] diff --git a/compass/landice/tests/mesh_modifications/subdomain_extractor/extract_region.py b/compass/landice/tests/mesh_modifications/subdomain_extractor/extract_region.py index ac984af1a6..fd2faa2280 100644 --- a/compass/landice/tests/mesh_modifications/subdomain_extractor/extract_region.py +++ b/compass/landice/tests/mesh_modifications/subdomain_extractor/extract_region.py @@ -144,7 +144,7 @@ def run(self): # mark horns for culling logger.info('Marking horns for culling') - args = ['mark_horns_for_culling.py', '-f', + args = ['mark_horns_for_culling', '-f', os.path.join(tmpdir, f'{source_file_rootname}_culled.nc')] check_call(args, logger=logger) @@ -158,8 +158,8 @@ def run(self): write_netcdf(ds_out, dest_mesh_only_name) # set lat/lon - logger.info('calling set_lat_lon_fields_in_planar_grid.py') - args = ['set_lat_lon_fields_in_planar_grid.py', + logger.info('calling set_lat_lon_fields_in_planar_grid') + args = ['set_lat_lon_fields_in_planar_grid', '-f', dest_mesh_only_name, '-p', mesh_projection] check_call(args, logger=logger) @@ -174,15 +174,17 @@ def run(self): mapping_filename = os.path.join(tmpdir, 'map_src_to_dst_nstd.nc') logger.info(f'Creating the mapping file {mapping_filename}...') - remapper = Remapper(in_descriptor, out_descriptor, - mapping_filename) - parallel_executable = config.get('parallel', 'parallel_executable') - remapper.build_mapping_file(method='neareststod', - mpiTasks=self.ntasks, - tempdir=self.work_dir, logger=logger, - esmf_parallel_exec=parallel_executable) # noqa + remapper = Remapper( + ntasks=self.ntasks, + map_filename=mapping_filename, + method='neareststod', + src_descriptor=in_descriptor, + dst_descriptor=out_descriptor, + parallel_exec=parallel_executable, + ) + remapper.build_map(logger=logger) logger.info('done.') logger.info('Remapping mesh file...') @@ -206,8 +208,8 @@ def run(self): elif interp_method == 'mali_interp': # create landice mesh - logger.info('calling create_landice_grid_from_generic_MPAS_grid.py') # noqa - args = ['create_landice_grid_from_generic_MPAS_grid.py', + logger.info('calling create_landice_grid_from_generic_mpas_grid') # noqa + args = ['create_landice_grid_from_generic_mpas_grid', '-i', os.path.join(tmpdir, 'dest_mesh_only.nc'), '-o', dest_file_name, '-l', f'{levels}', '-v', 'glimmer', @@ -216,8 +218,8 @@ def run(self): # interpolate to new mesh using nearest neighbor to ensure we get # identical values - logger.info('calling interpolate_to_mpasli_grid.py') - args = ['interpolate_to_mpasli_grid.py', + logger.info('calling interpolate_to_mpasli_grid') + args = ['interpolate_to_mpasli_grid', '-s', source_file_path, '-d', dest_file_name, '-m', 'n'] check_call(args, logger=logger) @@ -226,7 +228,7 @@ def run(self): # mark Dirichlet boundaries logger.info('Marking domain boundaries dirichlet') - args = ['mark_domain_boundaries_dirichlet.py', + args = ['mark_domain_boundaries_dirichlet', '-f', dest_file_name] check_call(args, logger=logger) diff --git a/compass/landice/tests/mesh_modifications/subdomain_extractor/subdomain_extractor.cfg b/compass/landice/tests/mesh_modifications/subdomain_extractor/subdomain_extractor.cfg index c4b7395584..34f555c436 100644 --- a/compass/landice/tests/mesh_modifications/subdomain_extractor/subdomain_extractor.cfg +++ b/compass/landice/tests/mesh_modifications/subdomain_extractor/subdomain_extractor.cfg @@ -42,7 +42,7 @@ grow_iters = 15 # nstd weight file and then uses ncremap to perform remapping. # This method supports interpolating ancillary files (below) # but likely needs to be run on a compute node and is more fragile. -# 'mali_interp' uses the MALI interpolation script interpolate_to_mpasli_grid.py +# 'mali_interp' uses the MALI interpolation script interpolate_to_mpasli_grid # This method does not support ancillary files but may be more robust # and can likely be run quickly on a login node. interp_method = ncremap diff --git a/compass/landice/tests/mismipplus/setup_mesh.py b/compass/landice/tests/mismipplus/setup_mesh.py index 8c4cdae04b..964e19b374 100644 --- a/compass/landice/tests/mismipplus/setup_mesh.py +++ b/compass/landice/tests/mismipplus/setup_mesh.py @@ -119,7 +119,7 @@ def run(self): levels = section.get('levels') vertMethod = section.get('vetical_layer_distribution') - args = ['create_landice_grid_from_generic_MPAS_grid.py', + args = ['create_landice_grid_from_generic_mpas_grid', '-i', 'mpas_grid.nc', '-o', 'landice_grid.nc', '-l', levels, diff --git a/compass/ocean/mesh/remap_topography.cfg b/compass/ocean/mesh/remap_topography.cfg index 7982c8f68d..db4af458ed 100644 --- a/compass/ocean/mesh/remap_topography.cfg +++ b/compass/ocean/mesh/remap_topography.cfg @@ -28,9 +28,6 @@ renorm_threshold = 0.01 # the density of land ice from MALI (kg/m^3) ice_density = 910.0 -# smoothing parameters -# no smoothing (required for esmf): -# expandDist = 0 [m] -# expandFactor = 1 [cell fraction] -expandDist = 0 -expandFactor = 1 +# smoothing parameters (no smoothing by default) +expand_dist = 0 +expand_factor = 1 diff --git a/compass/ocean/mesh/remap_topography.py b/compass/ocean/mesh/remap_topography.py index 27dab80d92..2e68eab95e 100644 --- a/compass/ocean/mesh/remap_topography.py +++ b/compass/ocean/mesh/remap_topography.py @@ -133,17 +133,17 @@ def _create_target_scrip_file(self): config = self.config section = config['remap_topography'] - expandDist = section.getfloat('expandDist') - expandFactor = section.getfloat('expandFactor') + expand_dist = section.getfloat('expand_dist') + expand_factor = section.getfloat('expand_factor') descriptor = MpasCellMeshDescriptor( - fileName='base_mesh.nc', - meshName=self.mesh_name, + filename='base_mesh.nc', + mesh_name=self.mesh_name, ) descriptor.to_scrip( 'target.scrip.nc', - expandDist=expandDist, - expandFactor=expandFactor, + expand_dist=expand_dist, + expand_factor=expand_factor, ) logger.info(' Done.') diff --git a/compass/ocean/tests/global_ocean/files_for_e3sm/diagnostic_maps.py b/compass/ocean/tests/global_ocean/files_for_e3sm/diagnostic_maps.py index 0e4e379850..8da3e020e9 100644 --- a/compass/ocean/tests/global_ocean/files_for_e3sm/diagnostic_maps.py +++ b/compass/ocean/tests/global_ocean/files_for_e3sm/diagnostic_maps.py @@ -97,9 +97,9 @@ def _make_analysis_lat_lon_map(config, mesh_name, ntasks, logger): lon_res = config.getfloat('files_for_e3sm', 'comparisonLonResolution') # modify the resolution of the global lat-lon grid as desired - out_descriptor = get_lat_lon_descriptor(dLon=lat_res, - dLat=lon_res) - out_grid_name = out_descriptor.meshName + out_descriptor = get_lat_lon_descriptor(dlon=lat_res, + dlat=lon_res) + out_grid_name = out_descriptor.mesh_name _make_mapping_file(mesh_name, out_grid_name, mesh_filename, out_descriptor, ntasks, config, logger) @@ -210,19 +210,27 @@ def _make_mapping_file(mesh_name, out_grid_name, mesh_filename, out_descriptor, mapping_file_name = f'map_{mesh_name}_to_{out_grid_name}_bilinear.nc' - remapper = Remapper(in_descriptor, out_descriptor, mapping_file_name) - - remapper.build_mapping_file(method='bilinear', mpiTasks=ntasks, - tempdir='.', logger=logger, - esmf_parallel_exec=parallel_executable) + remapper = Remapper( + ntasks=ntasks, + map_filename=mapping_file_name, + method='bilinear', + src_descriptor=in_descriptor, + dst_descriptor=out_descriptor, + parallel_exec=parallel_executable, + ) + remapper.build_map(logger=logger) # now the same on vertices (e.g. for streamfunctions) in_descriptor = MpasVertexMeshDescriptor(mesh_filename, mesh_name) mapping_file_name = \ f'map_{mesh_name}_vertices_to_{out_grid_name}_bilinear.nc' - remapper = Remapper(in_descriptor, out_descriptor, mapping_file_name) - - remapper.build_mapping_file(method='bilinear', mpiTasks=ntasks, - tempdir='.', logger=logger, - esmf_parallel_exec=parallel_executable) + remapper = Remapper( + ntasks=ntasks, + map_filename=mapping_file_name, + method='bilinear', + src_descriptor=in_descriptor, + dst_descriptor=out_descriptor, + parallel_exec=parallel_executable, + ) + remapper.build_map(logger=logger) diff --git a/compass/ocean/tests/global_ocean/files_for_e3sm/remap_iceberg_climatology.py b/compass/ocean/tests/global_ocean/files_for_e3sm/remap_iceberg_climatology.py index efa93d8f05..b71c618732 100644 --- a/compass/ocean/tests/global_ocean/files_for_e3sm/remap_iceberg_climatology.py +++ b/compass/ocean/tests/global_ocean/files_for_e3sm/remap_iceberg_climatology.py @@ -135,8 +135,8 @@ def remap_iceberg_climo( ds.to_netcdf(monotonic_filename) logger.info('Creating the source grid descriptor...') - src_descriptor = LatLonGridDescriptor.read(fileName=monotonic_filename) - src_mesh_name = src_descriptor.meshName + src_descriptor = LatLonGridDescriptor.read(filename=monotonic_filename) + src_mesh_name = src_descriptor.mesh_name logger.info('Creating the destination MPAS mesh descriptor...') dst_descriptor = MpasCellMeshDescriptor(mesh_filename, mesh_name) @@ -145,18 +145,25 @@ def remap_iceberg_climo( f'{mapping_directory}/map_{src_mesh_name}_to_{mesh_name}_{method}.nc' # noqa: E501 logger.info(f'Creating the mapping file {mapping_filename}...') - remapper = Remapper(src_descriptor, dst_descriptor, mapping_filename) - remapper.build_mapping_file(method=method, mpiTasks=mpi_tasks, - tempdir=mapping_directory, logger=logger, - esmf_parallel_exec=parallel_executable) + remapper = Remapper( + ntasks=mpi_tasks, + map_filename=mapping_filename, + method=method, + src_descriptor=src_descriptor, + dst_descriptor=dst_descriptor, + parallel_exec=parallel_executable, + ) + + remapper.build_map(logger=logger) logger.info('Remapping...') name, ext = os.path.splitext(out_filename) remap_filename = f'{name}_after_remap{ext}' - remapper.remap_file(inFileName=monotonic_filename, - outFileName=remap_filename, - logger=logger) + remapper.ncremap( + in_filename=monotonic_filename, + out_filename=remap_filename, + logger=logger) ds = xr.open_dataset(remap_filename) logger.info('Removing lat/lon vertex variables...') @@ -164,7 +171,6 @@ def remap_iceberg_climo( ds = ds.drop_vars(drop) logger.info('Renaming dimensions and variables...') rename = dict( - ncol='nCells', month='Time', Icb_flux='bergFreshwaterFluxData') ds = ds.rename(rename) diff --git a/compass/ocean/tests/global_ocean/files_for_e3sm/remap_sea_surface_salinity_restoring.py b/compass/ocean/tests/global_ocean/files_for_e3sm/remap_sea_surface_salinity_restoring.py index 3ff8ad7afe..f9495f5701 100644 --- a/compass/ocean/tests/global_ocean/files_for_e3sm/remap_sea_surface_salinity_restoring.py +++ b/compass/ocean/tests/global_ocean/files_for_e3sm/remap_sea_surface_salinity_restoring.py @@ -134,13 +134,10 @@ def _create_target_scrip_file(self, target_mesh_filename, mesh_name): self.write_netcdf(ds_out, 'expandDist.nc') descriptor = MpasCellMeshDescriptor( - fileName=target_mesh_filename, - meshName=mesh_name, - ) - descriptor.to_scrip( - scrip_filename, - expandDist=expand_dist + filename=target_mesh_filename, + mesh_name=mesh_name, ) + descriptor.to_scrip(scrip_filename, expand_dist=expand_dist) logger.info(' Done.') return scrip_filename @@ -229,7 +226,6 @@ def _modify_remapped_sss(self, remap_filename, out_filename): drop = [var for var in ds if 'nv' in ds[var].dims] ds = ds.drop_vars(drop) logger.info('Renaming dimensions and variables...') - rename = dict(ncol='nCells', - SALT='surfaceSalinityMonthlyClimatologyValue') + rename = dict(SALT='surfaceSalinityMonthlyClimatologyValue') ds = ds.rename(rename) self.write_netcdf(ds, out_filename) diff --git a/compass/ocean/tests/global_ocean/files_for_e3sm/remap_tidal_mixing.py b/compass/ocean/tests/global_ocean/files_for_e3sm/remap_tidal_mixing.py index 36cda101ef..8f925d1965 100644 --- a/compass/ocean/tests/global_ocean/files_for_e3sm/remap_tidal_mixing.py +++ b/compass/ocean/tests/global_ocean/files_for_e3sm/remap_tidal_mixing.py @@ -132,9 +132,12 @@ def remap_tidal( in_grid_name = 'S71W70_CATS_ustar' src_descriptor = ProjectionGridDescriptor.read( - projection=projection_in, fileName=in_filename, - meshName=in_grid_name, xVarName='x', yVarName='y') - src_mesh_name = src_descriptor.meshName + projection=projection_in, + filename=in_filename, + mesh_name=in_grid_name, + x_var_name='x', + y_var_name='y') + src_mesh_name = src_descriptor.mesh_name dst_descriptor = MpasCellMeshDescriptor(mesh_filename, mesh_name) @@ -142,11 +145,17 @@ def remap_tidal( f'{mapping_directory}/map_{src_mesh_name}_to_{mesh_name}_{method}.nc' # noqa: E501 logger.info(f'Creating the mapping file {mapping_filename}...') - remapper = Remapper(src_descriptor, dst_descriptor, mapping_filename) - remapper.build_mapping_file(method=method, mpiTasks=mpi_tasks, - tempdir=mapping_directory, logger=logger, - esmf_parallel_exec=parallel_executable) + remapper = Remapper( + ntasks=mpi_tasks, + map_filename=mapping_filename, + method=method, + src_descriptor=src_descriptor, + dst_descriptor=dst_descriptor, + parallel_exec=parallel_executable, + ) + + remapper.build_map(logger=logger) logger.info('done.') field = 'velocityTidalRMS' diff --git a/compass/ocean/tests/global_ocean/files_for_e3sm/seaice_graph_partition.py b/compass/ocean/tests/global_ocean/files_for_e3sm/seaice_graph_partition.py index f41c33de40..51a9c7f744 100644 --- a/compass/ocean/tests/global_ocean/files_for_e3sm/seaice_graph_partition.py +++ b/compass/ocean/tests/global_ocean/files_for_e3sm/seaice_graph_partition.py @@ -156,10 +156,15 @@ def _make_mapping_file(in_mesh_filename, in_mesh_name, out_mesh_filename, in_descriptor = MpasCellMeshDescriptor(in_mesh_filename, in_mesh_name) out_descriptor = MpasCellMeshDescriptor(out_mesh_filename, out_mesh_name) - remapper = Remapper(in_descriptor, out_descriptor, mapping_file_name) - - remapper.build_mapping_file(method=method, mpiTasks=ntasks, - tempdir='.', logger=logger, - esmf_parallel_exec=parallel_executable) + remapper = Remapper( + ntasks=ntasks, + map_filename=mapping_file_name, + method=method, + src_descriptor=in_descriptor, + dst_descriptor=out_descriptor, + parallel_exec=parallel_executable, + ) + + remapper.build_map(logger=logger) return mapping_file_name diff --git a/compass/ocean/tests/global_ocean/init/remap_ice_shelf_melt.py b/compass/ocean/tests/global_ocean/init/remap_ice_shelf_melt.py index 8842fde07a..9ccf5725a1 100644 --- a/compass/ocean/tests/global_ocean/init/remap_ice_shelf_melt.py +++ b/compass/ocean/tests/global_ocean/init/remap_ice_shelf_melt.py @@ -181,7 +181,7 @@ def remap_paolo(in_filename, base_mesh_filename, culled_mesh_filename, logger.info('Creating the source grid descriptor...') in_descriptor = ProjectionGridDescriptor.create( - projection=projection, x=x.values, y=y.values, meshName=in_grid_name) + projection=projection, x=x.values, y=y.values, mesh_name=in_grid_name) logger.info('done.') out_descriptor = MpasCellMeshDescriptor(base_mesh_filename, mesh_name) @@ -190,16 +190,22 @@ def remap_paolo(in_filename, base_mesh_filename, culled_mesh_filename, f'{mapping_directory}/map_{in_grid_name}_to_{mesh_name}_base.nc' logger.info(f'Creating the mapping file {mapping_filename}...') - remapper = Remapper(in_descriptor, out_descriptor, mapping_filename) - remapper.build_mapping_file(method=method, mpiTasks=mpi_tasks, - tempdir=mapping_directory, logger=logger, - esmf_parallel_exec=parallel_executable, - include_logs=True) + remapper = Remapper( + ntasks=mpi_tasks, + map_filename=mapping_filename, + method=method, + src_descriptor=in_descriptor, + dst_descriptor=out_descriptor, + parallel_exec=parallel_executable, + ) + + remapper.build_map(logger=logger) + logger.info('done.') - dx = np.abs(in_descriptor.xCorner[1:] - in_descriptor.xCorner[:-1]) - dy = np.abs(in_descriptor.yCorner[1:] - in_descriptor.yCorner[:-1]) + dx = np.abs(in_descriptor.x_corner[1:] - in_descriptor.x_corner[:-1]) + dy = np.abs(in_descriptor.y_corner[1:] - in_descriptor.y_corner[:-1]) dx, dy = np.meshgrid(dx, dy) planar_area = xr.DataArray(dims=('y', 'x'), data=dx * dy) @@ -251,8 +257,8 @@ def remap_paolo(in_filename, base_mesh_filename, culled_mesh_filename, logger.info('') logger.info('Remapping...') - ds_remap = remapper.remap( - ds, renormalizationThreshold=renormalization_threshold) + ds_remap = remapper.remap_numpy( + ds, renormalization_threshold=renormalization_threshold) logger.info('done.') logger.info('') @@ -388,7 +394,7 @@ def remap_adusumilli(in_filename, base_mesh_filename, culled_mesh_filename, logger.info('Creating the source grid descriptor...') in_descriptor = ProjectionGridDescriptor.create( - projection=projection, x=x, y=y, meshName=in_grid_name) + projection=projection, x=x, y=y, mesh_name=in_grid_name) logger.info('done.') logger.info('Creating the source xarray dataset...') @@ -419,16 +425,23 @@ def remap_adusumilli(in_filename, base_mesh_filename, culled_mesh_filename, f'{mapping_directory}/map_{in_grid_name}_to_{mesh_name}_base.nc' logger.info(f'Creating the mapping file {mapping_filename}...') - remapper = Remapper(in_descriptor, out_descriptor, mapping_filename) - remapper.build_mapping_file(method=method, mpiTasks=mpi_tasks, - tempdir=mapping_directory, logger=logger, - esmf_parallel_exec=parallel_executable) + remapper = Remapper( + ntasks=mpi_tasks, + map_filename=mapping_filename, + method=method, + src_descriptor=in_descriptor, + dst_descriptor=out_descriptor, + parallel_exec=parallel_executable, + ) + + remapper.build_map(logger=logger) + logger.info('done.') logger.info('Remapping...') - ds_remap = remapper.remap( - ds, renormalizationThreshold=renormalization_threshold) + ds_remap = remapper.remap_numpy( + ds, renormalization_threshold=renormalization_threshold) logger.info('done.') if map_culled_to_base_filename is None: diff --git a/compass/ocean/tests/global_ocean/mesh/remap_mali_topography/__init__.py b/compass/ocean/tests/global_ocean/mesh/remap_mali_topography/__init__.py index 0293715bab..d7ded7a8dd 100644 --- a/compass/ocean/tests/global_ocean/mesh/remap_mali_topography/__init__.py +++ b/compass/ocean/tests/global_ocean/mesh/remap_mali_topography/__init__.py @@ -93,16 +93,16 @@ def run(self): def _remap_mali_topo(self): in_mesh_name = self.mali_ais_topo in_descriptor = MpasCellMeshDescriptor( - fileName='mali_topography_orig.nc', - meshName=in_mesh_name) + filename='mali_topography_orig.nc', + mesh_name=in_mesh_name) in_descriptor.format = 'NETCDF3_64BIT' in_descriptor.to_scrip('mali.scrip.nc') self._partition_scrip_file('mali.scrip.nc') out_mesh_name = self.mesh_name out_descriptor = MpasCellMeshDescriptor( - fileName='base_mesh.nc', - meshName=out_mesh_name) + filename='base_mesh.nc', + mesh_name=out_mesh_name) out_descriptor.format = 'NETCDF3_64BIT' out_descriptor.to_scrip('mpaso.scrip.nc') self._partition_scrip_file('mpaso.scrip.nc') diff --git a/compass/ocean/tests/utility/combine_topo/__init__.py b/compass/ocean/tests/utility/combine_topo/__init__.py index b653bb68ca..fead818d9e 100644 --- a/compass/ocean/tests/utility/combine_topo/__init__.py +++ b/compass/ocean/tests/utility/combine_topo/__init__.py @@ -386,7 +386,7 @@ def _create_target_scrip_file(self): # Build lat-lon SCRIP file using pyremap elif self.target_grid == 'lat_lon': descriptor = get_lat_lon_descriptor( - dLon=self.resolution, dLat=self.resolution, + dlon=self.resolution, dlat=self.resolution, ) descriptor.to_scrip(netcdf4_filename) diff --git a/compass/ocean/tests/utility/extrap_woa/remap_topography.py b/compass/ocean/tests/utility/extrap_woa/remap_topography.py index fcd57d461f..ba79d45bc4 100644 --- a/compass/ocean/tests/utility/extrap_woa/remap_topography.py +++ b/compass/ocean/tests/utility/extrap_woa/remap_topography.py @@ -66,26 +66,34 @@ def run(self): method = config.get('extrap_woa', 'remap_method') - in_descriptor = LatLonGridDescriptor.read(fileName='topography.nc', + in_descriptor = LatLonGridDescriptor.read(filename='topography.nc', lonVarName='lon', latVarName='lat') - in_mesh_name = in_descriptor.meshName + in_mesh_name = in_descriptor.mesh_name - out_descriptor = LatLonGridDescriptor.read(fileName='woa.nc', + out_descriptor = LatLonGridDescriptor.read(filename='woa.nc', lonVarName='lon', latVarName='lat') - out_mesh_name = out_descriptor.meshName + out_mesh_name = out_descriptor.mesh_name mapping_file_name = \ f'map_{in_mesh_name}_to_{out_mesh_name}_{method}.nc' - remapper = Remapper(in_descriptor, out_descriptor, mapping_file_name) - remapper.build_mapping_file(method=method, mpiTasks=self.ntasks, - tempdir='.', logger=logger, - esmf_parallel_exec=parallel_executable) - - remapper.remap_file(inFileName='topography.nc', - outFileName='topography_remapped.nc', - logger=logger) + remapper = Remapper( + ntasks=self.ntasks, + map_filename=mapping_file_name, + method=method, + src_descriptor=in_descriptor, + dst_descriptor=out_descriptor, + parallel_exec=parallel_executable, + ) + + remapper.build_map(logger=logger) + + remapper.ncremap( + in_filename='topography.nc', + out_filename='topography_remapped.nc', + logger=logger + ) diff --git a/compass/version.py b/compass/version.py index 3fd0d93cfa..64a532e33d 100644 --- a/compass/version.py +++ b/compass/version.py @@ -1 +1 @@ -__version__ = '1.7.0-alpha.1' +__version__ = '1.7.0-alpha.2' diff --git a/conda/bootstrap.py b/conda/bootstrap.py index a5682ba2c2..dcb56e3da0 100755 --- a/conda/bootstrap.py +++ b/conda/bootstrap.py @@ -366,7 +366,11 @@ def build_jigsaw(activate_env, source_path, env_path, logger): commands = \ f'{activate_env} && ' \ f'conda remove -y --force-remove jigsaw jigsawpy' - check_call(commands, logger=logger) + try: + check_call(commands, logger=logger) + except subprocess.CalledProcessError: + # it's fine if these aren't installed, we just want to make sure + pass commands = \ f'{activate_env} && ' \ diff --git a/conda/compass_env/spec-file.template b/conda/compass_env/spec-file.template index 2cc1536b9a..c3cb816ad4 100644 --- a/conda/compass_env/spec-file.template +++ b/conda/compass_env/spec-file.template @@ -22,7 +22,7 @@ matplotlib-base >=3.9.1 metis moab >=5.5.1 moab=*={{ mpi_prefix }}_tempest_* -mpas_tools=0.36.0 +mpas_tools=1.0.0 nco netcdf4=*=nompi_* numpy >=2.0,<3.0 @@ -32,7 +32,7 @@ otps=2021.10 progressbar2 pyamg >=4.2.2 pyproj -pyremap>=1.3.0,<2.0.0 +pyremap>=2.0.0,<3.0.0 requests ruamel.yaml # having pip check problems with this version diff --git a/docs/developers_guide/framework.rst b/docs/developers_guide/framework.rst index f2e7d71d19..482db29ddd 100644 --- a/docs/developers_guide/framework.rst +++ b/docs/developers_guide/framework.rst @@ -244,7 +244,7 @@ functions. Here is a code snippet from section = config['dome'] ... levels = section.getfloat('levels') - args = ['create_landice_grid_from_generic_MPAS_grid.py', + args = ['create_landice_grid_from_generic_mpas_grid', '-i', 'mpas_grid.nc', '-o', 'landice_grid.nc', '-l', levels] @@ -253,7 +253,7 @@ functions. Here is a code snippet from ... -This example calls the script ``create_landice_grid_from_generic_MPAS_grid.py`` +This example calls the script ``create_landice_grid_from_generic_mpas_grid`` from ``mpas_tools`` with several arguments, making use of the ``logger``. .. _dev_io: diff --git a/docs/developers_guide/landice/test_groups/circular_shelf.rst b/docs/developers_guide/landice/test_groups/circular_shelf.rst index 2c5b81f055..c5a0517827 100644 --- a/docs/developers_guide/landice/test_groups/circular_shelf.rst +++ b/docs/developers_guide/landice/test_groups/circular_shelf.rst @@ -30,7 +30,7 @@ constructed at runtime (using :py:func:`mpas_tools.planar_hex.make_planar_hex_mesh()`). A MALI grid is created with the MPAS-Tools script -``create_landice_grid_from_generic_MPAS_grid.py`` and a graph file is created +``create_landice_grid_from_generic_mpas_grid`` and a graph file is created to partition the mesh before the model run. Finally, the initial condition is defined in the private function diff --git a/docs/developers_guide/landice/test_groups/dome.rst b/docs/developers_guide/landice/test_groups/dome.rst index b18e8ae87d..175c5d33c7 100644 --- a/docs/developers_guide/landice/test_groups/dome.rst +++ b/docs/developers_guide/landice/test_groups/dome.rst @@ -47,7 +47,7 @@ The variable resolution mesh is downloaded from section of the config file. A MALI grid is created with the MPAS-Tools script -``create_landice_grid_from_generic_MPAS_grid.py`` and a graph file is created +``create_landice_grid_from_generic_mpas_grid`` and a graph file is created to partition the mesh before the model run. Finally, the initial condition is defined in the private function diff --git a/docs/developers_guide/landice/test_groups/eismint2.rst b/docs/developers_guide/landice/test_groups/eismint2.rst index c46c75b7f9..43cc627470 100644 --- a/docs/developers_guide/landice/test_groups/eismint2.rst +++ b/docs/developers_guide/landice/test_groups/eismint2.rst @@ -30,7 +30,7 @@ defines a step for setting up the mesh for each test case. The horizontal mesh is constructed at runtime (using :py:func:`mpas_tools.planar_hex.make_planar_hex_mesh()`). A MALI grid is created with the MPAS-Tools script -``create_landice_grid_from_generic_MPAS_grid.py`` and a graph file is created +``create_landice_grid_from_generic_mpas_grid`` and a graph file is created to partition the mesh before the model run. run_experiment diff --git a/docs/developers_guide/landice/test_groups/enthalpy_benchmark.rst b/docs/developers_guide/landice/test_groups/enthalpy_benchmark.rst index b92809ca7c..8fd8ba91c7 100644 --- a/docs/developers_guide/landice/test_groups/enthalpy_benchmark.rst +++ b/docs/developers_guide/landice/test_groups/enthalpy_benchmark.rst @@ -34,7 +34,7 @@ defines a step for setting up the mesh for each test case. The horizontal mesh is constructed at runtime (using :py:func:`mpas_tools.planar_hex.make_planar_hex_mesh()`). Then, a MALI grid is -created with the MPAS-Tools script ``create_landice_grid_from_generic_MPAS_grid.py`` +created with the MPAS-Tools script ``create_landice_grid_from_generic_mpas_grid`` and a graph file is created to partition the mesh before the model run. Finally, the initial condition is defined in the private function diff --git a/docs/developers_guide/landice/test_groups/hydro_radial.rst b/docs/developers_guide/landice/test_groups/hydro_radial.rst index e82704b221..c63e501b62 100644 --- a/docs/developers_guide/landice/test_groups/hydro_radial.rst +++ b/docs/developers_guide/landice/test_groups/hydro_radial.rst @@ -31,7 +31,7 @@ defines a step for setting up the mesh for each test case. The horizontal mesh is constructed at runtime (using :py:func:`mpas_tools.planar_hex.make_planar_hex_mesh()`). A MALI grid is created with the MPAS-Tools script -``create_landice_grid_from_generic_MPAS_grid.py`` and a graph file is created +``create_landice_grid_from_generic_mpas_grid`` and a graph file is created to partition the mesh before the model run. Finally, the initial condition is defined in the private function diff --git a/docs/developers_guide/landice/test_groups/ismip6_forcing.rst b/docs/developers_guide/landice/test_groups/ismip6_forcing.rst index 4f9d2e88aa..da9dab1faf 100644 --- a/docs/developers_guide/landice/test_groups/ismip6_forcing.rst +++ b/docs/developers_guide/landice/test_groups/ismip6_forcing.rst @@ -9,7 +9,7 @@ atmospheric and oceanic forcing data of the Ice Sheet Model Intercomparison for CMIP6 (ISMIP6) protocol from its native polarstereo grid to the unstructure MALI mesh. The test group includes five test cases: ``atmosphere``, ``ocean_basal``, ``ocean_thermal_obs``, ``ocean_thermal`` and -``shelf_collapse``. The ``atmosphere`` test case has two steps: +``shelf_collapse``. The ``atmosphere`` test case has two steps: ``process_smb`` and ``process_smb_racmo``; the ``ocean_basal`` and ``shelf_collpase`` test cases each have one step, ``process_basal_melt`` and ``process_shelf_collpase`` (respectively); the ``ocean_thermal_obs`` and ``ocean_thermal`` @@ -34,15 +34,15 @@ create_mapfile The module :py:class:`compass.landice.tests.ismip6_forcing.create_mapfile` defines a unified framework for creating the SCRIP and mapping files from the ISMIP6 -source data files. The function +source data files. The function :py:func:`compass.landice.tests.ismip6_forcing.create_mapfile.build_mapping_file` is the common interface to build the SCRIP files and mapping files. The ``scrip_from_latlon`` keyword argument is used to call the appropriate function for generating the SCRIP file. If ``scrip_from_latlon`` is ``false`` the -``create_SCRIP_file_from_planar_rectangular_grid.py`` command line executable -from the ``MPAS_Tools`` conda package is used, otherwise the +``create_scrip_file_from_planar_rectangular_grid`` command line executable +from the ``MPAS_Tools`` conda package is used, otherwise the :py:func:`compass.landice.tests.ismip6_forcing.create_mapfile.create_scrip_from_latlon` -function is used. Multiple methods for creating SCRIP files are necessary due to +function is used. Multiple methods for creating SCRIP files are necessary due to inconsistent dimensions names across the different ISMIP6 datasets. Test cases @@ -87,4 +87,4 @@ shelf_collapse ~~~~~~~~~~~~~~ The :py:class:`compass.landice.tests.ismip6_forcing.shelf_collapse.ShelfCollapse` test case performs the processing of ice shelf collapse masks by remapping the -original ISMIP6 forcing data to MALI's unstructured grid and renaming variables. +original ISMIP6 forcing data to MALI's unstructured grid and renaming variables. diff --git a/docs/developers_guide/landice/test_groups/ismip6_run.rst b/docs/developers_guide/landice/test_groups/ismip6_run.rst index 6a79f18a4e..6f29ef68ee 100644 --- a/docs/developers_guide/landice/test_groups/ismip6_run.rst +++ b/docs/developers_guide/landice/test_groups/ismip6_run.rst @@ -28,7 +28,7 @@ excessive subdirectories. The ``configure`` method is where the experiments to be set up are determined. The config option ``exp_list`` is parsed and each experiment to be included -is set up as a step of the test case by calling the +is set up as a step of the test case by calling the ``SetUpExperiment`` constructor (``__init__``). All of the experiments are removed from ``steps_to_run``, because the experiments (steps) are not meant to be run together through the test @@ -70,7 +70,7 @@ in the comparison of post-simulation ice mass calculations from the model output To address this issue, an interim solution has been made to project the southern polar region onto the MALI planar mesh assuming a sphere (this is done by setting the lat/long in the MALI mesh using the 'aid-bedmap2-sphere' projection string in -calling the function in 'set_lat_lon_fields_in_planar_grid.py'. Thus, the resulting +calling the function in 'set_lat_lon_fields_in_planar_grid'. Thus, the resulting MALI mesh for coupled MALI-SLM simulations that are setup from this testgroup have the lat/long values based off sphere. Once the simulation outputs are generated, it is necessary to calculate and apply the scaling factors to the MALI outputs diff --git a/docs/developers_guide/landice/test_groups/mesh_modifications.rst b/docs/developers_guide/landice/test_groups/mesh_modifications.rst index f20b2c3a29..0e58e954dd 100644 --- a/docs/developers_guide/landice/test_groups/mesh_modifications.rst +++ b/docs/developers_guide/landice/test_groups/mesh_modifications.rst @@ -42,7 +42,7 @@ steps: * interpolate fields from source mesh to subdomain mesh using nearest neighbor interpolation. - This can be done either with the ``interpolate_to_mpasli_grid.py`` script + This can be done either with the ``interpolate_to_mpasli_grid`` script or using ``ncremap``. The ncremap method is slower and potentially more fragile (depends on more external tools), but if used allows the option to remap additional files (e.g. forcing files). diff --git a/docs/tutorials/dev_add_rrm.rst b/docs/tutorials/dev_add_rrm.rst index 701c6e9e50..71a415514c 100644 --- a/docs/tutorials/dev_add_rrm.rst +++ b/docs/tutorials/dev_add_rrm.rst @@ -1868,7 +1868,7 @@ run: .. code-block:: bash - paraview_vtk_field_extractor.py -m init.nc \ + paraview_vtk_field_extractor -m init.nc \ -f output.nc -v normalVelocity,temperature,salinity \ -d nVertLevels=0 diff --git a/docs/users_guide/landice/test_groups/antarctica.rst b/docs/users_guide/landice/test_groups/antarctica.rst index cef797f9ee..ec49e5f1df 100644 --- a/docs/users_guide/landice/test_groups/antarctica.rst +++ b/docs/users_guide/landice/test_groups/antarctica.rst @@ -73,19 +73,19 @@ the mesh generation options are adjusted through the config file. # path to directory containing BedMachine and Measures datasets # (default value is for Perlmutter) data_path = /global/cfs/cdirs/fanssie/standard_datasets/AIS_datasets - + # filename of the BedMachine thickness and bedTopography dataset # (default value is for Perlmutter) bedmachine_filename = BedMachineAntarctica_2020-07-15_v02_edits_floodFill_extrap_fillVostok.nc - + # filename of the MEASURES ice velocity dataset # (default value is for Perlmutter) measures_filename = antarctica_ice_velocity_450m_v2_edits_extrap.nc - + # projection of the source datasets, according to the dictionary keys - # create_SCRIP_file_from_planar_rectangular_grid.py from MPAS_Tools + # create_scrip_file_from_planar_rectangular_grid from MPAS_Tools src_proj = ais-bedmap2 - + # number of processors to use for ESMF_RegridWeightGen nProcs = 128 diff --git a/docs/users_guide/landice/test_groups/greenland.rst b/docs/users_guide/landice/test_groups/greenland.rst index 146119b909..ae0285589b 100644 --- a/docs/users_guide/landice/test_groups/greenland.rst +++ b/docs/users_guide/landice/test_groups/greenland.rst @@ -90,19 +90,19 @@ The other test cases do not use config options. # path to directory containing BedMachine and Measures datasets # (default value is for Perlmutter) data_path = /global/cfs/cdirs/fanssie/standard_datasets/GIS_datasets/ - + # filename of the BedMachine thickness and bedTopography dataset # (default value is for Perlmutter) bedmachine_filename = BedMachineGreenland-v5_edits_floodFill_extrap.nc - + # filename of the MEASURES ice velocity dataset # (default value is for Perlmutter) measures_filename = greenland_vel_mosaic500_extrap.nc - + # projection of the source datasets, according to the dictionary keys - # create_SCRIP_file_from_planar_rectangular_grid.py from MPAS_Tools + # create_scrip_file_from_planar_rectangular_grid from MPAS_Tools src_proj = gis-gimp - + # number of processors to use for ESMF_RegridWeightGen nProcs = 128 diff --git a/docs/users_guide/landice/test_groups/ismip6_run.rst b/docs/users_guide/landice/test_groups/ismip6_run.rst index ac5b3390d3..2ab1ad04f0 100644 --- a/docs/users_guide/landice/test_groups/ismip6_run.rst +++ b/docs/users_guide/landice/test_groups/ismip6_run.rst @@ -173,7 +173,7 @@ in the comparison of post-simulation ice mass calculations from the model output To address this issue, an interim solution has been made to project the southern polar region onto the MALI planar mesh assuming a sphere (this is done by setting the lat/long in the MALI mesh using the 'aid-bedmap2-sphere' projection string in -calling the function in 'set_lat_lon_fields_in_planar_grid.py'. Thus, the resulting +calling the function in 'set_lat_lon_fields_in_planar_grid'. Thus, the resulting MALI mesh for coupled MALI-SLM simulations that are setup from this testgroup have the lat/long values based off sphere. Once the simulation outputs are generated, it is necessary to calculate and apply the scaling factors to the MALI outputs diff --git a/docs/users_guide/landice/test_groups/mesh_modifications.rst b/docs/users_guide/landice/test_groups/mesh_modifications.rst index 063bd37e81..33e1dba0b4 100644 --- a/docs/users_guide/landice/test_groups/mesh_modifications.rst +++ b/docs/users_guide/landice/test_groups/mesh_modifications.rst @@ -88,7 +88,7 @@ the test case. # nstd weight file and then uses ncremap to perform remapping. # This method supports interpolating ancillary files (below) # but likely needs to be run on a compute node and is more fragile. - # 'mali_interp' uses the MALI interpolation script interpolate_to_mpasli_grid.py + # 'mali_interp' uses the MALI interpolation script interpolate_to_mpasli_grid # This method does not support ancillary files but may be more robust # and can likely be run quickly on a login node. interp_method = ncremap diff --git a/docs/users_guide/ocean/framework/mesh.rst b/docs/users_guide/ocean/framework/mesh.rst index 778e5d548f..650278a0d9 100644 --- a/docs/users_guide/ocean/framework/mesh.rst +++ b/docs/users_guide/ocean/framework/mesh.rst @@ -50,12 +50,10 @@ controlled by the following config options: # the density of land ice from MALI (kg/m^3) ice_density = 910.0 - # smoothing parameters - # no smoothing (required for esmf): - # expandDist = 0 [m] - # expandFactor = 1 [cell fraction] - expandDist = 0 - expandFactor = 1 + # smoothing parameters (no smoothing by default) + expand_dist = 0 + expand_factor = 1 + The topography and source SCRIP filenames should be something from the ocean `bathymetry database `_. diff --git a/setup.py b/setup.py index 228e117822..b194d6835a 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,6 @@ def package_files(directory, prefixes, extensions): 'gsw', 'h5py', 'ipython', - 'jigsawpy', 'jupyter', 'lxml', 'matplotlib',