|
1 | | -import os |
2 | | -import shutil |
3 | | - |
4 | | -import numpy as np |
5 | | -import xarray |
6 | | - |
7 | 1 | from compass.model import run_model |
8 | 2 | from compass.ocean.tests.isomip_plus.evap import update_evaporation_flux |
9 | | -from compass.ocean.tests.isomip_plus.viz.plot import MoviePlotter |
10 | 3 | from compass.ocean.time import get_time_interval_string |
11 | 4 | from compass.step import Step |
12 | 5 |
|
@@ -157,78 +150,6 @@ def run(self): |
157 | 150 |
|
158 | 151 | run_model(self) |
159 | 152 |
|
160 | | - if self.name == 'performance': |
161 | | - # plot a few fields |
162 | | - plot_folder = f'{self.work_dir}/plots' |
163 | | - if os.path.exists(plot_folder): |
164 | | - shutil.rmtree(plot_folder) |
165 | | - |
166 | | - dsMesh = xarray.open_dataset(os.path.join(self.work_dir, |
167 | | - 'init.nc')) |
168 | | - ds = xarray.open_dataset(os.path.join(self.work_dir, 'output.nc')) |
169 | | - |
170 | | - section_y = self.config.getfloat('isomip_plus_viz', 'section_y') |
171 | | - # show progress only if we're not writing to a log file |
172 | | - show_progress = self.log_filename is None |
173 | | - plotter = MoviePlotter(inFolder=self.work_dir, |
174 | | - streamfunctionFolder=self.work_dir, |
175 | | - outFolder=plot_folder, sectionY=section_y, |
176 | | - dsMesh=dsMesh, ds=ds, expt=self.experiment, |
177 | | - showProgress=show_progress) |
178 | | - |
179 | | - plotter.plot_horiz_series(ds.ssh, 'ssh', 'ssh', |
180 | | - True, vmin=-700, vmax=0) |
181 | | - plotter.plot_3d_field_top_bot_section( |
182 | | - ds.temperature, nameInTitle='temperature', prefix='temp', |
183 | | - units='C', vmin=-2., vmax=1., cmap='cmo.thermal') |
184 | | - |
185 | | - plotter.plot_3d_field_top_bot_section( |
186 | | - ds.salinity, nameInTitle='salinity', prefix='salin', |
187 | | - units='PSU', vmin=33.8, vmax=34.7, cmap='cmo.haline') |
188 | | - tol = 1e-10 |
189 | | - dsIce = xarray.open_dataset( |
190 | | - os.path.join(self.work_dir, |
191 | | - 'land_ice_fluxes.nc')) |
192 | | - if 'topDragMagnitude' in dsIce.keys(): |
193 | | - plotter.plot_horiz_series( |
194 | | - dsIce.topDragMagnitude, |
195 | | - 'topDragMagnitude', 'topDragMagnitude', True, |
196 | | - vmin=0 + tol, vmax=np.max(dsIce.topDragMagnitude.values), |
197 | | - cmap_set_under='k') |
198 | | - if 'landIceHeatFlux' in dsIce.keys(): |
199 | | - plotter.plot_horiz_series( |
200 | | - dsIce.landIceHeatFlux, |
201 | | - 'landIceHeatFlux', 'landIceHeatFlux', True, |
202 | | - vmin=np.min(dsIce.landIceHeatFlux.values), |
203 | | - vmax=np.max(dsIce.landIceHeatFlux.values)) |
204 | | - if 'landIceInterfaceTemperature' in dsIce.keys(): |
205 | | - plotter.plot_horiz_series( |
206 | | - dsIce.landIceInterfaceTemperature, |
207 | | - 'landIceInterfaceTemperature', |
208 | | - 'landIceInterfaceTemperature', |
209 | | - True, |
210 | | - vmin=np.min(dsIce.landIceInterfaceTemperature.values), |
211 | | - vmax=np.max(dsIce.landIceInterfaceTemperature.values)) |
212 | | - if 'landIceFreshwaterFlux' in dsIce.keys(): |
213 | | - plotter.plot_horiz_series( |
214 | | - dsIce.landIceFreshwaterFlux, |
215 | | - 'landIceFreshwaterFlux', 'landIceFreshwaterFlux', True, |
216 | | - vmin=0 + tol, vmax=1e-4, |
217 | | - cmap_set_under='k', cmap_scale='log') |
218 | | - if 'landIceFraction' in dsIce.keys(): |
219 | | - plotter.plot_horiz_series( |
220 | | - dsIce.landIceFraction, |
221 | | - 'landIceFraction', 'landIceFraction', True, |
222 | | - vmin=0 + tol, vmax=1 - tol, |
223 | | - cmap='cmo.balance', |
224 | | - cmap_set_under='k', cmap_set_over='r') |
225 | | - if 'landIceFloatingFraction' in dsIce.keys(): |
226 | | - plotter.plot_horiz_series( |
227 | | - dsIce.landIceFloatingFraction, |
228 | | - 'landIceFloatingFraction', 'landIceFloatingFraction', |
229 | | - True, vmin=0 + tol, vmax=1 - tol, |
230 | | - cmap='cmo.balance', cmap_set_under='k', cmap_set_over='r') |
231 | | - |
232 | 153 | if self.name == 'simulation': |
233 | 154 | update_evaporation_flux( |
234 | 155 | in_forcing_file='forcing_data_init.nc', |
|
0 commit comments