@@ -75,7 +75,11 @@ def prepare_mpaso_mesh_data(self):
75
75
# create needed masks and remap them in separate file
76
76
mpasoDomainMask = np .ones ((self .nCells ,), dtype = np .double )
77
77
mpasoDomainMaskDA = xr .DataArray (mpasoDomainMask , name = 'mpasoDomainMask' , dims = ("nCells" ), attrs = {'long_name' :'MPAS-Ocean domain mask' })
78
- mpasoOpenOceanMaskDA = xr .DataArray (np .logical_not (self .landIceFloatingMask ).astype (np .double ), name = 'mpasoOpenOceanMask' , dims = ("nCells" ), attrs = {'long_name' :'MPAS-Ocean open ocean mask' })
78
+ mask1d = np .logical_not (self .landIceFloatingMask ).astype (np .double )
79
+ mpasoOpenOceanMaskDA = xr .DataArray (mask1d ,
80
+ name = 'mpasoOpenOceanMask' ,
81
+ dims = ("nCells" ,),
82
+ attrs = {'long_name' :'MPAS-Ocean open ocean mask' })
79
83
80
84
# prepare file to be remapped
81
85
out_data_vars = xr .merge ([mpasoDomainMaskDA , mpasoOpenOceanMaskDA ])
@@ -91,6 +95,20 @@ def prepare_mpaso_mesh_data(self):
91
95
"-m" , self .mapping_file_name ]
92
96
check_call (args_remap )
93
97
98
+ # Now on MALI mesh, clean up open ocean mask so it can be used by MALI extrap code
99
+ ds = xr .open_dataset ("mpaso_masks_on_mali_mesh.nc" , decode_times = False , decode_cf = False )
100
+ mask1d = ds .mpasoOpenOceanMask [:].values
101
+ mask1d = np .where (mask1d > 0.99 , 1.0 , 0.0 ).astype (np .int32 ) # only keep values close to 1
102
+ mask2d = np .tile (mask1d .reshape (- 1 , 1 ), (1 , len (self .ismip6shelfMelt_zOcean ))) # tile mask across all vertical layers
103
+ mask3d = mask2d [np .newaxis , :, :] # add time dimension
104
+ mpasoOpenOceanMaskDA = xr .DataArray (mask3d ,
105
+ name = 'orig3dOceanMask' ,
106
+ dims = ("Time" , "nCells" , "nISMIP6OceanLayers" ),
107
+ attrs = {'long_name' :'MPAS-Ocean open ocean mask' })
108
+ #dataOut = xr.Dataset(data_vars=(mpasoOpenOceanMaskDA))
109
+ mpasoOpenOceanMaskDA .to_netcdf ('orig3dOceanMask_open_ocean_mask.nc' , mode = 'w' )
110
+
111
+
94
112
def get_data (self , year ):
95
113
96
114
# open and concatenate diagnostic dataset
0 commit comments