コード例 #1
0
 def get_component_instance(self):
     # Create Radiation Prognostic
     radiation = RRTMGLongwave()
     # Create Convection Prognostic
     convection = EmanuelConvection()
     # Create a SimplePhysics Prognostic
     boundary_layer = TimeDifferencingWrapper(SimplePhysics())
     return GFSDynamicalCore([radiation, convection, boundary_layer])
コード例 #2
0
 def get_component_instance(self, state_modification_func=lambda x: x):
     component = SimplePhysics()
     component = component.prognostic_version()
     component.current_time_step = timedelta(minutes=10)
     return component
コード例 #3
0
 def get_component_instance(self, state_modification_func=lambda x: x):
     return SimplePhysics()
コード例 #4
0
ファイル: simple_physics_example.py プロジェクト: sit23/climt
from climt import SimplePhysics, get_default_state
from datetime import timedelta


def plot_function(fig, state):
    ax = fig.add_subplot(1, 1, 1)
    ax.plot(state['specific_humidity'].values.flatten(),
            state['air_pressure'].values.flatten(), '-o')
    ax.axes.invert_yaxis()
    ax.set_ylim(1e5, 100.)
    ax.set_xlabel('m/s')
    ax.set_ylabel('Pa')


monitor = PlotFunctionMonitor(plot_function)
simple_physics = SimplePhysics(use_external_surface_specific_humidity=False)
state = get_default_state([simple_physics])
state['eastward_wind'].values[:] = 10.
timestep = timedelta(hours=1)

for i in range(600):

    diagnostics, new_state = simple_physics(state, timestep)
    print('SH Flux:',
          diagnostics['surface_upward_sensible_heat_flux'].values.item())
    print('LH Flux:',
          diagnostics['surface_upward_latent_heat_flux'].values.item())
    state.update(diagnostics)
    monitor.store(state)
    state.update(new_state)
コード例 #5
0
 def get_component_instance(self):
     component = TimeDifferencingWrapper(SimplePhysics())
     return component
コード例 #6
0
 def get_component_instance(self):
     return SimplePhysics()
コード例 #7
0
    ax.set_title('Net Flux')
    ax.axes.invert_yaxis()
    ax.set_xlabel('W/m^2')
    ax.grid()
    plt.tight_layout()


monitor = PlotFunctionMonitor(plot_function)

timestep = timedelta(minutes=5)

convection = EmanuelConvection()
radiation_sw = RRTMGShortwave()
radiation_lw = RRTMGLongwave()
slab = SlabSurface()
simple_physics = SimplePhysics()

store_quantities = [
    'air_temperature', 'air_pressure', 'specific_humidity',
    'air_pressure_on_interface_levels',
    'air_temperature_tendency_from_convection',
    'air_temperature_tendency_from_longwave',
    'air_temperature_tendency_from_shortwave'
]
netcdf_monitor = NetCDFMonitor('rad_conv_eq.nc',
                               store_names=store_quantities,
                               write_on_store=True)
convection.current_time_step = timestep

state = get_default_state(
    [simple_physics, convection, radiation_lw, radiation_sw, slab])