def setup_mpas_remapper(self, config): mpasMeshFileName = '{}/mpasMesh.nc'.format(self.datadir) comparisonDescriptor = \ get_comparison_descriptor(config, comparisonGridName='latlon') mpasDescriptor = MpasMeshDescriptor( mpasMeshFileName, meshName=config.get('input', 'mpasMeshName')) remapper = get_remapper( config=config, sourceDescriptor=mpasDescriptor, comparisonDescriptor=comparisonDescriptor, mappingFilePrefix='map', method=config.get( 'climatology', 'mpasInterpolationMethod')) return remapper
def setup_obs_remapper(self, config, fieldName): gridFileName = '{}/obsGrid.nc'.format(self.datadir) comparisonDescriptor = \ get_comparison_descriptor(config, comparisonGridName='latlon') obsDescriptor = LatLonGridDescriptor.read(fileName=gridFileName, latVarName='lat', lonVarName='lon') remapper = \ get_remapper( config=config, sourceDescriptor=obsDescriptor, comparisonDescriptor=comparisonDescriptor, mappingFilePrefix='map_obs_{}'.format(fieldName), method=config.get('oceanObservations', 'interpolationMethod')) return remapper
resolution. ''' from mpas_analysis.shared.interpolation import Remapper from mpas_analysis.shared.grid import MpasMeshDescriptor from mpas_analysis.shared.climatology import get_comparison_descriptor from mpas_analysis.configuration import MpasAnalysisConfigParser # replace with the MPAS mesh name inGridName = 'oQU240' # replace with the path to the desired mesh or restart file inGridFileName = '/media/xylar/extra_data/analysis/edison/G-QU240-master-intel/run/mpaso.rst.0001-01-06_00000.nc' config = MpasAnalysisConfigParser() config.read('mpas_analysis/config.default') # replace 1.0 with the desired resolution of the output mesh config.set('climatology', 'comparisonLatResolution', '1.0') config.set('climatology', 'comparisonLonResolution', '1.0') inDescriptor = MpasMeshDescriptor(inGridFileName, inGridName) outDescriptor = get_comparison_descriptor(config, 'latlon') outGridName = outDescriptor.meshName mappingFileName = 'map_{}_to_{}.nc'.format(inGridName, outGridName) remapper = Remapper(inDescriptor, outDescriptor, mappingFileName) remapper.build_mapping_file(method='bilinear')
''' from mpas_analysis.shared.interpolation import Remapper from mpas_analysis.shared.grid import MpasMeshDescriptor from mpas_analysis.shared.climatology import get_comparison_descriptor from mpas_analysis.configuration import MpasAnalysisConfigParser # replace with the MPAS mesh name inGridName = 'oQU240' # replace with the path to the desired mesh or restart file inGridFileName = '/media/xylar/extra_data/analysis/edison/G-QU240-master-intel/run/mpaso.rst.0001-01-06_00000.nc' config = MpasAnalysisConfigParser() config.read('mpas_analysis/config.default') # replace these numbers with the desired size and resolution of the output mesh config.set('climatology', 'comparisonAntarcticStereoWidth', '6000.0') config.set('climatology', 'comparisonAntarcticStereoResolution', '10.0') inDescriptor = MpasMeshDescriptor(inGridFileName, inGridName) outDescriptor = get_comparison_descriptor(config, 'antarctic') outGridName = outDescriptor.meshName mappingFileName = 'map_{}_to_{}.nc'.format(inGridName, outGridName) remapper = Remapper(inDescriptor, outDescriptor, mappingFileName) remapper.build_mapping_file(method='bilinear')