def run(self): """ Run this step of the test case """ logger = self.logger section = self.config['enthalpy_benchmark'] nx = section.getint('nx') ny = section.getint('ny') dc = section.getfloat('dc') levels = section.get('levels') dsMesh = make_planar_hex_mesh(nx=nx, ny=ny, dc=dc, nonperiodic_x=True, nonperiodic_y=True) write_netcdf(dsMesh, 'grid.nc') dsMesh = cull(dsMesh, logger=logger) dsMesh = convert(dsMesh, logger=logger) write_netcdf(dsMesh, 'mpas_grid.nc') args = ['create_landice_grid_from_generic_MPAS_grid.py', '-i', 'mpas_grid.nc', '-o', 'landice_grid.nc', '-l', levels, '--thermal'] check_call(args, logger) make_graph_file(mesh_filename='landice_grid.nc', graph_filename='graph.info') _setup_initial_conditions(section, 'landice_grid.nc')
def run(self): """ Run this step of the test case """ make_graph_file(mesh_filename=self.mesh_file, graph_filename='graph.info') for suffix in self.suffixes: run_model(step=self, namelist='namelist.{}'.format(suffix), streams='streams.{}'.format(suffix))
def run(self): """ Run this step of the test case """ logger = self.logger # only use progress bars if we're not writing to a log file use_progress_bar = self.log_filename is None # create the base mesh cellWidth, lon, lat = self.build_cell_width_lat_lon() build_spherical_mesh(cellWidth, lon, lat, out_filename='mesh.nc', logger=logger, use_progress_bar=use_progress_bar) make_graph_file(mesh_filename='mesh.nc', graph_filename='graph.info')
def run(self): """ Run this step of the test case """ logger = self.logger section = self.config['eismint2'] nx = section.getint('nx') ny = section.getint('ny') dc = section.getfloat('dc') dsMesh = make_planar_hex_mesh(nx=nx, ny=ny, dc=dc, nonperiodic_x=False, nonperiodic_y=False) dsMesh = convert(dsMesh, logger=logger) write_netcdf(dsMesh, 'mpas_grid.nc') dsMesh.close() radius = section.get('radius') args = [ 'define_cullMask.py', '-f', 'mpas_grid.nc', '-m', 'radius', '-d', radius ] check_call(args, logger) dsMesh = xarray.open_dataset('mpas_grid.nc') dsMesh = cull(dsMesh, logger=logger) dsMesh = convert(dsMesh, logger=logger) write_netcdf(dsMesh, 'mpas_grid2.nc') levels = section.get('levels') args = [ 'create_landice_grid_from_generic_MPAS_grid.py', '-i', 'mpas_grid2.nc', '-o', 'landice_grid.nc', '-l', levels, '--thermal', '--beta' ] check_call(args, logger) make_graph_file(mesh_filename='landice_grid.nc', graph_filename='graph.info')
def run(self): """ Run this step of the test case """ mesh_type = self.mesh_type logger = self.logger config = self.config section = config['dome'] if mesh_type == '2000m': nx = section.getint('nx') ny = section.getint('ny') dc = section.getfloat('dc') dsMesh = make_planar_hex_mesh(nx=nx, ny=ny, dc=dc, nonperiodic_x=True, nonperiodic_y=True) write_netcdf(dsMesh, 'grid.nc') dsMesh = cull(dsMesh, logger=logger) dsMesh = convert(dsMesh, logger=logger) write_netcdf(dsMesh, 'mpas_grid.nc') levels = section.get('levels') args = [ 'create_landice_grid_from_generic_MPAS_grid.py', '-i', 'mpas_grid.nc', '-o', 'landice_grid.nc', '-l', levels ] check_call(args, logger) make_graph_file(mesh_filename='landice_grid.nc', graph_filename='graph.info') _setup_dome_initial_conditions(config, logger, filename='landice_grid.nc')
def run(self): """ Run this step of the test case """ config = self.config resolution = float(self.resolution) section = config['planar_convergence'] nx_1km = section.getint('nx_1km') ny_1km = section.getint('ny_1km') nx = int(nx_1km / resolution) ny = int(ny_1km / resolution) dc = resolution * 1e3 ds_mesh = make_planar_hex_mesh(nx=nx, ny=ny, dc=dc, nonperiodic_x=False, nonperiodic_y=False) center(ds_mesh) write_netcdf(ds_mesh, 'mesh.nc') make_graph_file('mesh.nc', 'graph.info')
def run(self): """ Run this step of the test case """ logger = self.logger config = self.config section = config['humboldt'] logger.info('calling build_cell_wdith') cell_width, x1, y1, geom_points, geom_edges = self.build_cell_width() logger.info('calling build_planar_mesh') build_planar_mesh(cell_width, x1, y1, geom_points, geom_edges, logger=logger) dsMesh = xarray.open_dataset('base_mesh.nc') logger.info('culling mesh') dsMesh = cull(dsMesh, logger=logger) logger.info('converting to MPAS mesh') dsMesh = convert(dsMesh, logger=logger) logger.info('writing grid_converted.nc') write_netcdf(dsMesh, 'grid_converted.nc') # If no number of levels specified in config file, use 10 levels = section.get('levels') logger.info('calling create_landice_grid_from_generic_MPAS_grid.py') args = [ 'create_landice_grid_from_generic_MPAS_grid.py', '-i', 'grid_converted.nc', '-o', 'gis_1km_preCull.nc', '-l', levels, '-v', 'glimmer' ] check_call(args, logger=logger) # This step uses a subset of the whole Greenland dataset trimmed to # the region around Humboldt Glacier, to speed up interpolation. # This could also be replaced with the full Greenland Ice Sheet # dataset. logger.info('calling interpolate_to_mpasli_grid.py') args = [ 'interpolate_to_mpasli_grid.py', '-s', 'humboldt_1km_2020_04_20.epsg3413.icesheetonly.nc', '-d', 'gis_1km_preCull.nc', '-m', 'b', '-t' ] check_call(args, logger=logger) # This step is only necessary if you wish to cull a certain # distance from the ice margin, within the bounds defined by # the GeoJSON file. cullDistance = section.get('cullDistance') if float(cullDistance) > 0.: logger.info('calling define_cullMask.py') args = [ 'define_cullMask.py', '-f', 'gis_1km_preCull.nc', '-m' 'distance', '-d', cullDistance ] check_call(args, logger=logger) else: logger.info('cullDistance <= 0 in config file. ' 'Will not cull by distance to margin. \n') # This step is only necessary because the GeoJSON region # is defined by lat-lon. logger.info('calling set_lat_lon_fields_in_planar_grid.py') args = [ 'set_lat_lon_fields_in_planar_grid.py', '-f', 'gis_1km_preCull.nc', '-p', 'gis-gimp' ] check_call(args, logger=logger) logger.info('calling MpasMaskCreator.x') args = [ 'MpasMaskCreator.x', 'gis_1km_preCull.nc', 'humboldt_mask.nc', '-f', 'Humboldt.geojson' ] check_call(args, logger=logger) logger.info('culling to geojson file') dsMesh = xarray.open_dataset('gis_1km_preCull.nc') humboldtMask = xarray.open_dataset('humboldt_mask.nc') dsMesh = cull(dsMesh, dsInverse=humboldtMask, logger=logger) write_netcdf(dsMesh, 'humboldt_culled.nc') logger.info('Marking horns for culling') args = ['mark_horns_for_culling.py', '-f', 'humboldt_culled.nc'] check_call(args, logger=logger) logger.info('culling and converting') dsMesh = xarray.open_dataset('humboldt_culled.nc') dsMesh = cull(dsMesh, logger=logger) dsMesh = convert(dsMesh, logger=logger) write_netcdf(dsMesh, 'humboldt_dehorned.nc') logger.info('calling create_landice_grid_from_generic_MPAS_grid.py') args = [ 'create_landice_grid_from_generic_MPAS_grid.py', '-i', 'humboldt_dehorned.nc', '-o', 'Humboldt_1to10km.nc', '-l', levels, '-v', 'glimmer', '--beta', '--thermal', '--obs', '--diri' ] check_call(args, logger=logger) logger.info('calling interpolate_to_mpasli_grid.py') args = [ 'interpolate_to_mpasli_grid.py', '-s', 'humboldt_1km_2020_04_20.epsg3413.icesheetonly.nc', '-d', 'Humboldt_1to10km.nc', '-m', 'b', '-t' ] check_call(args, logger=logger) logger.info('Marking domain boundaries dirichlet') args = [ 'mark_domain_boundaries_dirichlet.py', '-f', 'Humboldt_1to10km.nc' ] check_call(args, logger=logger) logger.info('calling set_lat_lon_fields_in_planar_grid.py') args = [ 'set_lat_lon_fields_in_planar_grid.py', '-f', 'Humboldt_1to10km.nc', '-p', 'gis-gimp' ] check_call(args, logger=logger) logger.info('creating graph.info') make_graph_file(mesh_filename='Humboldt_1to10km.nc', graph_filename='graph.info')