Skip to content

Commit 80676a4

Browse files
committed
revert hacks, par_exe instead of srun
1 parent 729b06c commit 80676a4

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

compass/landice/mesh.py

+23-3
Original file line numberDiff line numberDiff line change
@@ -1051,9 +1051,9 @@ def __guess_scrip_name(filename):
10511051
return f"{base_fn}.scrip.nc"
10521052

10531053
logger = self.logger
1054-
weights_filename = "/lore/smithc11/projects/landice/compassData/" \
1055-
"alexCoarseMeshMappingData_01292025/" \
1056-
"gridded_to_MPAS_weights.nc" # HACK
1054+
1055+
source_scrip = __guess_scrip_name(os.path.basename(source_file))
1056+
weights_filename = "gridded_to_MPAS_weights.nc"
10571057

10581058
# make sure variables is a list, encompasses the variables="all" case
10591059
if isinstance(variables, str):
@@ -1062,6 +1062,26 @@ def __guess_scrip_name(filename):
10621062
raise TypeError("Arugment 'variables' is of incorrect type, must"
10631063
" either the string 'all' or a list of strings")
10641064

1065+
logger.info('creating scrip file for source dataset')
1066+
# Note: writing scrip file to workdir
1067+
args = ['create_SCRIP_file_from_planar_rectangular_grid.py',
1068+
'-i', source_file,
1069+
'-s', source_scrip,
1070+
'-p', proj,
1071+
'-r', '2']
1072+
check_call(args, logger=logger)
1073+
1074+
# Generate remapping weights
1075+
logger.info('generating gridded dataset -> MPAS weights')
1076+
args = [parallel_executable, '-n', nProcs, 'ESMF_RegridWeightGen',
1077+
'--source', source_scrip,
1078+
'--destination', mali_scrip,
1079+
'--weight', weights_filename,
1080+
'--method', 'conserve',
1081+
"--netcdf4",
1082+
"--dst_regional", "--src_regional", '--ignore_unmapped']
1083+
check_call(args, logger=logger)
1084+
10651085
# Perform actual interpolation using the weights
10661086
logger.info('calling interpolate_to_mpasli_grid.py')
10671087
args = ['interpolate_to_mpasli_grid.py',

0 commit comments

Comments
 (0)