Browse Source

Read in corners from script file

experiments/remove-exchange-grid
Sven Karsten 3 months ago
parent
commit
1ea86d4b5d
  1. 4
      scripts/prepare/grid_create_exchangegrid.py
  2. 4
      scripts/prepare/grid_create_uv_t_regridding.py
  3. 6
      scripts/prepare/grids.py

4
scripts/prepare/grid_create_exchangegrid.py

@ -45,8 +45,8 @@ def grid_create_exchangegrid(global_settings, # root directory of IOW ESM
####################################################
print(' reading in model grids...')
atmos_grid = Grid(from_grid=scrip_file_1, title=atmos_grid_title, grid_corners=4)
bottom_grid = Grid(from_grid=scrip_file_2, title=bottom_grid_title, grid_corners=4) # TODO: corners should be stored in scrip file
atmos_grid = Grid(from_grid=scrip_file_1, title=atmos_grid_title)
bottom_grid = Grid(from_grid=scrip_file_2, title=bottom_grid_title)
#######################################################
# STEP 3: CALCULATE POLYGONS AND THEIR BOUNDING BOXES #

4
scripts/prepare/grid_create_uv_t_regridding.py

@ -46,8 +46,8 @@ def grid_create_uv_t_regridding(global_settings, # root directory of IOW
####################################################
print(' reading in model grids...')
t_grid = Grid(from_grid=scrip_file_1, title=bottom_t_grid_title, grid_corners=4)
other_grid = Grid(from_grid=scrip_file_2, title=bottom_grid_title, grid_corners=4) # TODO: corners should be stored in scrip file
t_grid = Grid(from_grid=scrip_file_1, title=bottom_t_grid_title)
other_grid = Grid(from_grid=scrip_file_2, title=bottom_grid_title)
print(' contrstructing relevant grids from '+t_grid.title+' and '+other_grid.title+'...')

6
scripts/prepare/grids.py

@ -48,12 +48,14 @@ class Grid:
def read(self, file_name):
nc = netCDF4.Dataset(file_name, 'r')
self.grid_imask = nc.variables['grid_imask'][:]
self.grid_dims = nc.variables['grid_dims'][:]
self.grid_corners = nc.variables['grid_corners'][:]
self.grid_corners = len(self.grid_corners)
self.grid_corner_lon = nc.variables['grid_corner_lon'][:,:]
self.grid_corner_lat = nc.variables['grid_corner_lat'][:,:]
self.grid_center_lon = nc.variables['grid_center_lon'][:]
self.grid_center_lat = nc.variables['grid_center_lat'][:]
self.grid_imask = nc.variables['grid_imask'][:]
self.grid_dims = nc.variables['grid_dims'][:]
nc.close()

Loading…
Cancel
Save