Skip to content

Commit 16badff

Browse files
committed
Update BSF climatology map to use syntax for latest mpas_tools
1 parent faa7120 commit 16badff

1 file changed

Lines changed: 23 additions & 7 deletions

File tree

mpas_analysis/ocean/climatology_map_bsf.py

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import xarray as xr
1414

15-
from mpas_tools.ocean.barotropic_streamfunction import (
15+
from mpas_tools.ocean import (
1616
compute_barotropic_streamfunction,
1717
shift_barotropic_streamfunction
1818
)
@@ -216,7 +216,7 @@ def __init__(self, mpas_climatology_task, parent_task,
216216
variable_list, seasons, comparison_grid_names,
217217
subtaskName=subtask_name, vertices=True)
218218

219-
# this reequires a lot of memory so let's reserve all the available
219+
# this requires a lot of memory so let's reserve all the available
220220
# tasks
221221
parallelTaskCount = self.config.getint('execute', 'parallelTaskCount')
222222
self.subprocessCount = parallelTaskCount
@@ -316,11 +316,26 @@ def customize_masked_climatology(self, climatology, season):
316316
config = self.config
317317

318318
ds_mesh = xr.open_dataset(self.restartFileName)
319-
ds_mesh = ds_mesh[['cellsOnEdge', 'cellsOnVertex', 'nEdgesOnCell',
320-
'edgesOnCell', 'verticesOnCell', 'verticesOnEdge',
321-
'edgesOnVertex', 'dcEdge', 'dvEdge', 'bottomDepth',
322-
'maxLevelCell', 'latVertex', 'areaTriangle',]]
323-
ds_mesh.load()
319+
var_list = [
320+
'cellsOnEdge',
321+
'cellsOnVertex',
322+
'nEdgesOnCell',
323+
'edgesOnCell',
324+
'verticesOnCell',
325+
'verticesOnEdge',
326+
'edgesOnVertex',
327+
'dcEdge',
328+
'dvEdge',
329+
'bottomDepth',
330+
'minLevelCell',
331+
'maxLevelCell',
332+
'latVertex',
333+
'areaTriangle',
334+
]
335+
ds_mesh = ds_mesh[var_list].as_numpy()
336+
337+
masked_filename = self.get_masked_file_name(season)
338+
masked_dir = os.path.dirname(masked_filename)
324339

325340
cells_on_vertex = ds_mesh.cellsOnVertex - 1
326341
lat_vertex = ds_mesh.latVertex
@@ -332,6 +347,7 @@ def customize_masked_climatology(self, climatology, season):
332347
include_bolus=self.include_bolus,
333348
include_submesoscale=self.include_submesoscale,
334349
logger=logger,
350+
tmp_dir=masked_dir,
335351
)
336352

337353
lat_range = config.getexpression(

0 commit comments

Comments
 (0)