Skip to content

Commit

Permalink
Added conversion to netcdf3 in ocean/mesh/remap_topography
Browse files Browse the repository at this point in the history
  • Loading branch information
bmooremaley committed Nov 12, 2024
1 parent a9b0b17 commit 1777ca8
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions compass/ocean/mesh/remap_topography.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,20 +145,28 @@ def _partition_scrip_file(self, in_filename):
logger = self.logger
logger.info('Partition SCRIP file')

# Convert to 64-bit NetCDF
args = [
'ncks', '-5',
in_filename,
in_filename.replace('.nc', '.64bit.nc'),
]
check_call(args, logger)

# Convert source SCRIP to mbtempest
args = [
'mbconvert', '-B',
in_filename,
in_filename.replace('.nc', '.h5m'),
in_filename.replace('.nc', '.64bit.nc'),
in_filename.replace('.nc', '.64bit.h5m'),
]
check_call(args, logger)

# Partition source SCRIP
args = [
'mbpart', f'{self.ntasks}',
'-z', 'RCB',
in_filename.replace('.nc', '.h5m'),
in_filename.replace('.nc', f'.p{self.ntasks}.h5m'),
in_filename.replace('.nc', '.64bit.h5m'),
in_filename.replace('.nc', f'.64bit.p{self.ntasks}.h5m'),
]
check_call(args, logger)

Expand All @@ -173,8 +181,8 @@ def _create_weights(self):

args = [
'mbtempest', '--type', '5',
'--load', f'source.scrip.p{self.ntasks}.h5m',
'--load', f'target.scrip.p{self.ntasks}.h5m',
'--load', f'source.scrip.64bit.p{self.ntasks}.h5m',
'--load', f'target.scrip.64bit.p{self.ntasks}.h5m',
'--file', f'mapfv_source_to_target.nomask_{self.ntasks}_gnom.nc',
'--intx', 'moab_intx_source_target.h5m',
'--weights', '--verbose', '--gnomonic', '--boxeps', '1e-9',
Expand Down

0 comments on commit 1777ca8

Please sign in to comment.