Skip to content

Commit 600fb8f

Browse files
committed
Add time-varying forcing
1 parent 65b58f9 commit 600fb8f

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

polaris/ocean/tasks/isomip_plus/init/forcing.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ def run(self):
8080
Create restoring and other forcing files
8181
"""
8282
self._compute_restoring()
83+
self._write_time_varying_forcing()
8384

8485
def _compute_restoring(self):
8586
config = self.config
@@ -156,3 +157,35 @@ def _compute_restoring(self):
156157
ds_forcing['tidalInputMask'] = xr.zeros_like(ds_mesh.xIsomipCell)
157158

158159
write_netcdf(ds_forcing, 'init_mode_forcing_data.nc')
160+
161+
@staticmethod
162+
def _write_time_varying_forcing():
163+
"""
164+
Write time-varying land-ice forcing and update the initial condition
165+
"""
166+
167+
ds_topo = xr.open_dataset('topo.nc')
168+
169+
if 'Time' not in ds_topo.dims:
170+
# no time-varying forcing needed
171+
return
172+
173+
ds_out = xr.Dataset()
174+
ds_out['xtime'] = ds_topo.xtime
175+
176+
ds_out['landIceDraftForcing'] = ds_topo.landIceDraft
177+
ds_out.landIceDraftForcing.attrs['units'] = 'm'
178+
ds_out.landIceDraftForcing.attrs['long_name'] = \
179+
'The approximate elevation of the land ice-ocean interface'
180+
ds_out['landIcePressureForcing'] = ds_topo.landIcePressure
181+
ds_out.landIcePressureForcing.attrs['units'] = 'm'
182+
ds_out.landIcePressureForcing.attrs['long_name'] = \
183+
'Pressure from the weight of land ice at the ice-ocean interface'
184+
ds_out['landIceFractionForcing'] = ds_topo.landIceFraction
185+
ds_out.landIceFractionForcing.attrs['long_name'] = \
186+
'The fraction of each cell covered by land ice'
187+
ds_out['landIceFloatingFractionForcing'] = \
188+
ds_topo.landIceFloatingFraction
189+
ds_out.landIceFloatingFractionForcing.attrs['long_name'] = \
190+
'The fraction of each cell covered by floating land ice'
191+
write_netcdf(ds_out, 'land_ice_forcing.nc')

0 commit comments

Comments
 (0)