diff --git a/howto/atmosphere.md b/howto/atmosphere.md index c90146b..b5ada47 100644 --- a/howto/atmosphere.md +++ b/howto/atmosphere.md @@ -53,7 +53,7 @@ Finally, we can plot the equilibrated temperature profile ```{code-cell} ipython3 fig, ax = plt.subplots() -plots.profile_p_log(atmosphere['plev'], atmosphere['T'][-1, :]) +plots.profile_p_log(rce.atmosphere['plev'], rce.atmosphere['T'][-1, :]) ax.set_xlabel(r"$T$ / K") ax.set_ylabel("$p$ / hPa") ``` diff --git a/howto/clouds.md b/howto/clouds.md index 617a803..7a5d6d8 100644 --- a/howto/clouds.md +++ b/howto/clouds.md @@ -43,12 +43,12 @@ rce = konrad.RCE( rce.run() fig, (ax0, ax1) = plt.subplots(ncols=2, sharey=True) -plots.profile_p_log(atmosphere["plev"], atmosphere["T"][-1], ax=ax0) +plots.profile_p_log(rce.atmosphere["plev"], rce.atmosphere["T"][-1], ax=ax0) ax0.set_ylabel("$p$ / hPa") ax0.set_xlabel("$T$ / K") ax1.axvline(0, color="k", linewidth=0.8) -plots.profile_p_log(atmosphere["plev"], rce.radiation["net_htngrt"][-1], ax=ax1) +plots.profile_p_log(rce.atmosphere["plev"], rce.radiation["net_htngrt"][-1], ax=ax1) ax1.set_xlabel("Q / $\sf K\,day^{-1}$") ax1.set_xlim(-4, 0.5) ax1.set_ylim(bottom=phlev.max()) @@ -58,7 +58,7 @@ ax1.set_ylim(bottom=phlev.max()) ```{code-cell} ipython3 single_cloud = konrad.cloud.ConceptualCloud( - atmosphere, # required for consistent coordinates + rce.atmosphere, # required for consistent coordinates cloud_top=200e2, # in Pa depth=100e2, # in Pa phase="ice", # "ice" or "liquid" @@ -68,20 +68,20 @@ single_cloud = konrad.cloud.ConceptualCloud( rrtmg = konrad.radiation.RRTMG() rrtmg.update_heatingrates( - atmosphere=atmosphere, + atmosphere=rce.atmosphere, cloud=single_cloud, ) fig, (ax0, ax1) = plt.subplots(ncols=2, sharey=True) ax0.axvline(0, color="k", linewidth=0.8) -plots.profile_p_log(atmosphere["plev"], rrtmg["net_htngrt"][-1], ax=ax0) +plots.profile_p_log(rce.atmosphere["plev"], rrtmg["net_htngrt"][-1], ax=ax0) ax0.set_xlabel("Q / $\sf K\,day^{-1}$") ax0.set_xlim(-4, 0.5) ax0.set_ylabel("$p$ / hPa") ax0.set_ylim(bottom=phlev.max()) ax1.axvline(0, color="k", linewidth=0.8) -plots.profile_p_log(atmosphere["plev"], rrtmg["net_htngrt"][-1] - rrtmg["net_htngrt_clr"][-1], ax=ax1) +plots.profile_p_log(rce.atmosphere["plev"], rrtmg["net_htngrt"][-1] - rrtmg["net_htngrt_clr"][-1], ax=ax1) ax1.set_xlabel("$\sf Q_\mathrm{cloud}$ / $\sf K\,day^{-1}$") ax1.set_xlim(-2.25, 2.25) ax1.set_ylim(bottom=phlev.max()) diff --git a/howto/convection.md b/howto/convection.md index f325756..c9afd40 100644 --- a/howto/convection.md +++ b/howto/convection.md @@ -53,7 +53,7 @@ In a second step, we enable the convective adjustment. We copy the existing atmo ```{code-cell} ipython3 rce = konrad.RCE( - atmosphere.copy(), # Create an separate atmosphere component. + atmosphere, convection=konrad.convection.HardAdjustment(), timestep='24h', max_duration='150d', diff --git a/howto/feedback.md b/howto/feedback.md index 362ca7a..965a125 100644 --- a/howto/feedback.md +++ b/howto/feedback.md @@ -45,10 +45,10 @@ spinup = konrad.RCE( ) spinup.run() # Start the simulation. -atmosphere["CO2"][:] *= 2.0 # double the CO2 concentration +spinup.atmosphere["CO2"][:] *= 2.0 # double the CO2 concentration perturbed = konrad.RCE( - atmosphere, + spinup.atmosphere, surface=konrad.surface.SlabOcean( temperature=295.0, heat_sink=spinup.radiation["toa"][-1], diff --git a/howto/forcing.md b/howto/forcing.md index 3e4f2ac..a2b3cd5 100644 --- a/howto/forcing.md +++ b/howto/forcing.md @@ -54,8 +54,8 @@ atmospheric state, especially the temperature, occur. ```{code-cell} ipython3 # Calculate OLR at perturbed atmospheric state. -atmosphere["CO2"][:] *= 2 # double the CO2 concentration -spinup.radiation.update_heatingrates(atmosphere) +spinup.atmosphere["CO2"][:] *= 2 # double the CO2 concentration +spinup.radiation.update_heatingrates(spinup.atmosphere) instant_forcing = -(spinup.radiation["lw_flxu"][-1] - olr_ref) ``` @@ -94,7 +94,7 @@ The effective forcing includes the so called "stratospheric adjustment". One can simulated by keeping the surface temperature fixed but allowing the atmopsheric temperature to adjust to the increased CO2 concentration. ```{code-cell} ipython3 -perturbed = konrad.RCE(atmosphere.copy(), timestep='24h',max_duration='150d') +perturbed = konrad.RCE(spinup.atmosphere, timestep='24h',max_duration='150d') perturbed.run() effective_forcing = -(perturbed.radiation["lw_flxu"][-1] - olr_ref) diff --git a/howto/getting_started.md b/howto/getting_started.md index 6f49555..ed85237 100644 --- a/howto/getting_started.md +++ b/howto/getting_started.md @@ -68,7 +68,9 @@ Finally, we can plot the RCE state and compare it to the inital (standard) atmop ```{code-cell} ipython3 fig, ax = plt.subplots() -plots.profile_p_log(atmosphere['plev'], atmosphere['T'][-1, :]) +plots.profile_p_log(atmosphere['plev'], atmosphere['T'][-1, :], label="Init. state") +plots.profile_p_log(rce.atmosphere['plev'], rce.atmosphere['T'][-1, :], label="RCE") +ax.legend() ax.set_xlabel(r"$T$ / K") ax.set_ylabel("$p$ / hPa") ``` diff --git a/howto/humidity.md b/howto/humidity.md index 974cb9d..5d9be35 100644 --- a/howto/humidity.md +++ b/howto/humidity.md @@ -58,13 +58,13 @@ $Q_r$ is a decisive quantity in climate science as it destabilizies the atmosphe ```{code-cell} ipython3 fig, (ax0, ax1) = plt.subplots(ncols=2, sharey=True) -plots.profile_p_log(atmosphere['plev'], atmosphere['H2O'][-1, :], ax=ax0) +plots.profile_p_log(rce.atmosphere['plev'], rce.atmosphere['H2O'][-1, :], ax=ax0) ax0.set_xlabel(r"$q$ / VMR") ax0.set_xscale("log") ax0.set_ylabel("$p$ / hPa") ax1.axvline(0, color="k", linewidth=0.8) -plots.profile_p_log(atmosphere['plev'], rce.radiation["net_htngrt"][-1, :], ax=ax1) +plots.profile_p_log(rce.atmosphere['plev'], rce.radiation["net_htngrt"][-1, :], ax=ax1) ax1.set_xlim(-2, 0.5) ax1.set_xlabel(r"$Q_\mathrm{r}$ / (K/day)") ``` @@ -90,12 +90,12 @@ rce = konrad.RCE( rce.run() # Start the simulation. fig, (ax0, ax1) = plt.subplots(ncols=2, sharey=True) -plots.profile_p_log(atmosphere['plev'], atmosphere['H2O'][-1, :], ax=ax0) +plots.profile_p_log(rce.atmosphere['plev'], rce.atmosphere['H2O'][-1, :], ax=ax0) ax0.set_xlabel(r"$q$ / VMR") ax0.set_ylabel("$p$ / hPa") ax1.axvline(0, color="k", linewidth=0.8) -plots.profile_p_log(atmosphere['plev'], rce.radiation["net_htngrt"][-1, :], ax=ax1) +plots.profile_p_log(rce.atmosphere['plev'], rce.radiation["net_htngrt"][-1, :], ax=ax1) ax1.set_xlim(-2, 0.5) ax1.set_xlabel(r"$Q_\mathrm{r}$ / (K/day)") ``` diff --git a/howto/lapserate.md b/howto/lapserate.md index ed1afa6..83b59d6 100644 --- a/howto/lapserate.md +++ b/howto/lapserate.md @@ -57,7 +57,7 @@ for lapserate in [6.5, 8, 10]: ) rce.run() # Start the simulation. - plots.profile_p_log(atmosphere['plev'], atmosphere['T'][-1, :]) + plots.profile_p_log(rce.atmosphere['plev'], rce.atmosphere['T'][-1, :]) ax.set_xlabel(r"$T$ / K") ax.set_ylabel("$p$ / hPa") ``` @@ -79,7 +79,7 @@ rce = konrad.RCE( rce.run() # Start the simulation. fig, ax = plt.subplots() -plots.profile_p_log(atmosphere['plev'], atmosphere['T'][-1, :]) +plots.profile_p_log(rce.atmosphere['plev'], rce.atmosphere['T'][-1, :]) ax.set_xlabel(r"$T$ / K") ax.set_ylabel("$p$ / hPa") ``` @@ -106,7 +106,7 @@ for Ts in [280, 290, 300]: ) rce.run() # Start the simulation. - plots.profile_p_log(atmosphere['plev'], atmosphere['T'][-1, :]) + plots.profile_p_log(rce.atmosphere['plev'], rce.atmosphere['T'][-1, :]) ax.set_xlabel(r"$T$ / K") ax.set_ylabel("$p$ / hPa") ``` diff --git a/howto/netcdf_output.md b/howto/netcdf_output.md index 8a1a157..fb57254 100644 --- a/howto/netcdf_output.md +++ b/howto/netcdf_output.md @@ -92,5 +92,5 @@ rce = konrad.RCE( rce.run() # Plot adjusted state -plots.profile_p_log(atmosphere["plev"], atmosphere["T"][-1]) +plots.profile_p_log(rce.atmosphere["plev"], rce.atmosphere["T"][-1]) ``` diff --git a/howto/ozone.md b/howto/ozone.md index 3c29142..c1d7747 100644 --- a/howto/ozone.md +++ b/howto/ozone.md @@ -44,15 +44,15 @@ for Ts in [285, 295, 305]: ) rce.run() - l, = plots.profile_p_log(atmosphere["plev"], atmosphere["T"][-1], ax=ax0) + l, = plots.profile_p_log(rce.atmosphere["plev"], rce.atmosphere["T"][-1], ax=ax0) ax0.set_xlabel(r"$T$ / K") ax0.set_xlim(180, 306) ax0.set_ylabel("$p$ / hPa") ax0.set_ylim(bottom=atmosphere["plev"].max()) plots.profile_p_log( - atmosphere["plev"], - atmosphere["O3"][-1] * 1e6, + rce.atmosphere["plev"], + rce.atmosphere["O3"][-1] * 1e6, label=f"{Ts} K", color=l.get_color(), ax=ax1, @@ -81,15 +81,15 @@ for Ts in [285, 295, 305]: ) rce.run() - l, = plots.profile_p_log(atmosphere["plev"], atmosphere["T"][-1], ax=ax0) + l, = plots.profile_p_log(rce.atmosphere["plev"], rce.atmosphere["T"][-1], ax=ax0) ax0.set_xlabel(r"$T$ / K") ax0.set_xlim(180, 306) ax0.set_ylabel("$p$ / hPa") - ax0.set_ylim(bottom=atmosphere["plev"].max()) + ax0.set_ylim(bottom=rce.atmosphere["plev"].max()) plots.profile_p_log( - atmosphere["plev"], - atmosphere["O3"][-1] * 1e6, + rce.atmosphere["plev"], + rce.atmosphere["O3"][-1] * 1e6, label=f"{Ts} K", color=l.get_color(), ax=ax1,