Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to pyremap 1.1.0 #698

Merged
merged 2 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions compass/ocean/mesh/remap_topography.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import xarray as xr
from mpas_tools.io import write_netcdf
from pyremap import LatLonGridDescriptor, MpasMeshDescriptor, Remapper
from pyremap import LatLonGridDescriptor, MpasCellMeshDescriptor, Remapper

from compass.step import Step

Expand Down Expand Up @@ -108,8 +108,8 @@ def run(self):
in_mesh_name = in_descriptor.meshName

out_mesh_name = self.mesh_name
out_descriptor = MpasMeshDescriptor(fileName='base_mesh.nc',
meshName=self.mesh_name)
out_descriptor = MpasCellMeshDescriptor(fileName='base_mesh.nc',
meshName=self.mesh_name)

mapping_file_name = \
f'map_{in_mesh_name}_to_{out_mesh_name}_{method}.nc'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import numpy
import pyproj
from pyremap import (
MpasMeshDescriptor,
MpasCellMeshDescriptor,
MpasVertexMeshDescriptor,
ProjectionGridDescriptor,
Remapper,
get_lat_lon_descriptor,
Expand Down Expand Up @@ -205,7 +206,7 @@ def _make_mapping_file(mesh_name, out_grid_name, mesh_filename, out_descriptor,

parallel_executable = config.get('parallel', 'parallel_executable')

in_descriptor = MpasMeshDescriptor(mesh_filename, mesh_name)
in_descriptor = MpasCellMeshDescriptor(mesh_filename, mesh_name)

mapping_file_name = f'map_{mesh_name}_to_{out_grid_name}_bilinear.nc'

Expand All @@ -216,7 +217,7 @@ def _make_mapping_file(mesh_name, out_grid_name, mesh_filename, out_descriptor,
esmf_parallel_exec=parallel_executable)

# now the same on vertices (e.g. for streamfunctions)
in_descriptor = MpasMeshDescriptor(mesh_filename, mesh_name, vertices=True)
in_descriptor = MpasVertexMeshDescriptor(mesh_filename, mesh_name)
mapping_file_name = \
f'map_{mesh_name}_vertices_to_{out_grid_name}_bilinear.nc'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import numpy as np
import xarray as xr
from mpas_tools.io import write_netcdf
from pyremap import LatLonGridDescriptor, MpasMeshDescriptor, Remapper
from pyremap import LatLonGridDescriptor, MpasCellMeshDescriptor, Remapper

from compass.io import symlink
from compass.ocean.tests.global_ocean.files_for_e3sm.files_for_e3sm_step import ( # noqa: E501
Expand Down Expand Up @@ -142,7 +142,7 @@ def remap_iceberg_climo(in_filename, mesh_filename, mesh_name,
src_mesh_name = src_descriptor.meshName

logger.info('Creating the destination MPAS mesh descriptor...')
dst_descriptor = MpasMeshDescriptor(mesh_filename, mesh_name)
dst_descriptor = MpasCellMeshDescriptor(mesh_filename, mesh_name)

mapping_filename = \
f'{mapping_directory}/map_{src_mesh_name}_to_{mesh_name}_{method}.nc'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import xarray as xr
from mpas_tools.io import write_netcdf
from pyremap import LatLonGridDescriptor, MpasMeshDescriptor, Remapper
from pyremap import LatLonGridDescriptor, MpasCellMeshDescriptor, Remapper

from compass.io import symlink
from compass.ocean.tests.global_ocean.files_for_e3sm.files_for_e3sm_step import ( # noqa: E501
Expand Down Expand Up @@ -111,7 +111,7 @@ def remap_sss(in_filename, mesh_filename, mesh_name, out_filename, logger,
src_descriptor = LatLonGridDescriptor.read(fileName=in_filename)
src_mesh_name = src_descriptor.meshName

dst_descriptor = MpasMeshDescriptor(mesh_filename, mesh_name)
dst_descriptor = MpasCellMeshDescriptor(mesh_filename, mesh_name)

mapping_filename = \
f'{mapping_directory}/map_{src_mesh_name}_to_{mesh_name}_{method}.nc'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import xarray as xr
from mpas_tools.io import write_netcdf
from mpas_tools.logging import check_call
from pyremap import MpasMeshDescriptor, Remapper
from pyremap import MpasCellMeshDescriptor, Remapper

from compass.io import symlink
from compass.ocean.tests.global_ocean.files_for_e3sm.files_for_e3sm_step import ( # noqa: E501
Expand Down Expand Up @@ -154,8 +154,8 @@ def _make_mapping_file(in_mesh_filename, in_mesh_name, out_mesh_filename,

mapping_file_name = f'map_{in_mesh_name}_to_{out_mesh_name}_{method}.nc'

in_descriptor = MpasMeshDescriptor(in_mesh_filename, in_mesh_name)
out_descriptor = MpasMeshDescriptor(out_mesh_filename, out_mesh_name)
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)

Expand Down
4 changes: 2 additions & 2 deletions compass/ocean/tests/global_ocean/init/remap_ice_shelf_melt.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import xarray as xr
from mpas_tools.cime.constants import constants
from mpas_tools.io import write_netcdf
from pyremap import MpasMeshDescriptor, ProjectionGridDescriptor, Remapper
from pyremap import MpasCellMeshDescriptor, ProjectionGridDescriptor, Remapper

from compass.step import Step

Expand Down Expand Up @@ -172,7 +172,7 @@ def remap_adusumilli(in_filename, mesh_filename, mesh_name,
write_netcdf(ds, 'Adusumilli_2020_ismf_2010-2018_v0.nc')
logger.info('done.')

out_descriptor = MpasMeshDescriptor(mesh_filename, mesh_name)
out_descriptor = MpasCellMeshDescriptor(mesh_filename, mesh_name)

mapping_filename = \
f'{mapping_directory}/map_{in_grid_name}_to_{mesh_name}.nc'
Expand Down
2 changes: 1 addition & 1 deletion conda/compass_env/spec-file.template
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ otps=2021.10
progressbar2
pyamg >=4.2.2
pyproj
pyremap>=1.0.1,<2.0.0
pyremap>=1.1.0,<2.0.0
requests
ruamel.yaml
# having pip check problems with this version
Expand Down
Loading