@@ -1051,9 +1051,9 @@ def __guess_scrip_name(filename):
1051
1051
return f"{ base_fn } .scrip.nc"
1052
1052
1053
1053
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"
1057
1057
1058
1058
# make sure variables is a list, encompasses the variables="all" case
1059
1059
if isinstance (variables , str ):
@@ -1062,6 +1062,26 @@ def __guess_scrip_name(filename):
1062
1062
raise TypeError ("Arugment 'variables' is of incorrect type, must"
1063
1063
" either the string 'all' or a list of strings" )
1064
1064
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
+
1065
1085
# Perform actual interpolation using the weights
1066
1086
logger .info ('calling interpolate_to_mpasli_grid.py' )
1067
1087
args = ['interpolate_to_mpasli_grid.py' ,
0 commit comments