{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Random Forest Example: Cloud-resolving model sensitivity\n", "\n", "In this example, we will use an ensemble of large-domain simulations of realistic shallow cloud fields to explore the sensitivity of shallow precipitation to local changes in the environment. \n", "\n", "The simulation data we use for training the emulator is taken from a recent study Dagan and Stier (2020), where they performed ensemble daily simulations for one month-long period during December 2013 over the ocean to the East of Barbados, such that they samepled variability associated with shallow convection. Each day of the month consisted of two runs, both forced by realistic boundary conditions taken from reanalysis, but with different cloud droplet number concentrations (CDNC) to represent clean and polluted conditions. The altered CDNC was found to have little impact on the precipitation rate in the simulations, and so we simply treat the CDNC change as a perturbation to the initial conditions, and combine the two CDNC runs from each day together to increase the amount of data available for training the emulator. At hourly resolution, this provides us with 1488 data points.\n", "\n", "However, given that the amount of precipitation is strongly tied to the local cloud regime, not fully controlling for cloud regime can introduce spurious correlations when training the emulator. As such we also filter out all hours which are not associated with shallow convective clouds. To do this, we consider domain-mean vertical profiles of total cloud water content (liquid + ice), q$_{t}$, and filter out all hours where the vertical sum of q$_{t}$ below 600hPa exceeds 10$^{-6}$ kg/kg. This condition allows us to filter out hours associated with the onset and development of deep convection in the domain, as well as masking out hours with high cirrus layers or hours dominated by transient mesoscale convective activity which is advected in by the boundary conditions. After this, we are left with 850 hourly data point which meet our criteria and can be used to train the emulator.\n", "\n", "In this example we emulate hourly `precip` using domain-mean features: `liquid water path` (LWP), `geopotential height at 700hPa` (z$_{700}$), `Estimated Inversion Strength` (EIS), `sea-surface temperature` (SST) and the `vertical pressure velocity at 700hPa` (w700). \n", "\n", "\n", "\n", "**References:**\n", "\n", "Dagan, G. and Stier, P.: Ensemble daily simulations for elucidating cloud–aerosol interactions under a large spread of realistic environmental conditions, Atmos. Chem. Phys., 20, 6291–6303, https://doi.org/10.5194/acp-20-6291-2020, 2020." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import pandas as pd\n", "import iris\n", "\n", "from utils import get_crm_data\n", "from esem.utils import LeaveOneOut, plot_results, prettify_plot, add_121_line\n", "\n", "from esem import rf_model\n", "\n", "from matplotlib import pyplot as plt\n", "plt.style.use('default')\n", "%matplotlib inline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Concatenate 20cdnc and 200cdnc runs into one dataframe" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | precip | \n", "pres_msl | \n", "LWP | \n", "WS10 | \n", "lhfl_s | \n", "shfl_s | \n", "LTS | \n", "w500 | \n", "w600 | \n", "w700 | \n", "wmax850 | \n", "wstd850 | \n", "zg500 | \n", "zg600 | \n", "zg700 | \n", "rh850 | \n", "rh700 | \n", "u_shear | \n", "EIS | \n", "SST | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "0.004593 | \n", "101407.410 | \n", "0.035898 | \n", "6.639860 | \n", "-167.53857 | \n", "5.745860 | \n", "13.180252 | \n", "-0.014463 | \n", "-0.012311 | \n", "-0.010275 | \n", "-0.000024 | \n", "0.000947 | \n", "56627.516 | \n", "42694.220 | \n", "30541.566 | \n", "67.243774 | \n", "60.067740 | \n", "-4.662799 | \n", "0.989443 | \n", "301.173248 | \n", "
1 | \n", "0.006900 | \n", "101356.266 | \n", "0.044468 | \n", "6.822748 | \n", "-176.93939 | \n", "4.438721 | \n", "13.279678 | \n", "-0.015064 | \n", "-0.012710 | \n", "-0.008676 | \n", "0.000030 | \n", "0.000382 | \n", "56572.645 | \n", "42640.473 | \n", "30488.172 | \n", "69.299180 | \n", "58.453730 | \n", "-4.322696 | \n", "1.130803 | \n", "301.173248 | \n", "
2 | \n", "0.008916 | \n", "101316.420 | \n", "0.051559 | \n", "6.798490 | \n", "-182.61697 | \n", "3.649221 | \n", "13.333527 | \n", "-0.014811 | \n", "-0.012014 | \n", "-0.006025 | \n", "0.000642 | \n", "0.000511 | \n", "56525.613 | \n", "42593.594 | \n", "30442.703 | \n", "71.522900 | \n", "56.912193 | \n", "-3.925541 | \n", "1.242463 | \n", "301.173248 | \n", "
3 | \n", "0.008932 | \n", "101270.490 | \n", "0.057509 | \n", "6.756970 | \n", "-188.87599 | \n", "3.033055 | \n", "13.328018 | \n", "-0.013470 | \n", "-0.012141 | \n", "-0.004758 | \n", "0.001519 | \n", "0.000476 | \n", "56471.332 | \n", "42539.062 | \n", "30390.662 | \n", "74.115690 | \n", "55.652990 | \n", "-3.556972 | \n", "1.304206 | \n", "301.173248 | \n", "
4 | \n", "0.016204 | \n", "101256.270 | \n", "0.064226 | \n", "6.763690 | \n", "-194.85498 | \n", "2.826119 | \n", "13.317032 | \n", "-0.010917 | \n", "-0.011119 | \n", "-0.003158 | \n", "0.003252 | \n", "0.000958 | \n", "56443.758 | \n", "42510.805 | \n", "30364.852 | \n", "77.510765 | \n", "54.434470 | \n", "-3.319007 | \n", "1.362710 | \n", "301.173248 | \n", "
... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "... | \n", "
845 | \n", "0.063121 | \n", "101309.750 | \n", "0.064794 | \n", "8.253145 | \n", "-191.23718 | \n", "12.219704 | \n", "10.142059 | \n", "-0.024480 | \n", "-0.006400 | \n", "-0.007968 | \n", "-0.000044 | \n", "0.001105 | \n", "56084.273 | \n", "42214.140 | \n", "30222.945 | \n", "83.696740 | \n", "77.278465 | \n", "-5.993636 | \n", "-2.696190 | \n", "300.126465 | \n", "
846 | \n", "0.064601 | \n", "101303.110 | \n", "0.063914 | \n", "8.326073 | \n", "-192.57118 | \n", "11.947702 | \n", "10.162674 | \n", "-0.019426 | \n", "0.000300 | \n", "-0.003904 | \n", "-0.000034 | \n", "0.000588 | \n", "56071.547 | \n", "42206.734 | \n", "30214.715 | \n", "84.196236 | \n", "77.536760 | \n", "-5.848422 | \n", "-2.673406 | \n", "300.126465 | \n", "
847 | \n", "0.046773 | \n", "101332.234 | \n", "0.059974 | \n", "8.404624 | \n", "-193.80084 | \n", "12.372276 | \n", "10.166580 | \n", "-0.014384 | \n", "0.004355 | \n", "-0.000284 | \n", "-0.000251 | \n", "0.000650 | \n", "56079.492 | \n", "42225.984 | \n", "30236.312 | \n", "84.394960 | \n", "77.754560 | \n", "-5.663757 | \n", "-2.643809 | \n", "300.126465 | \n", "
848 | \n", "0.056623 | \n", "101394.280 | \n", "0.062895 | \n", "8.385845 | \n", "-192.18195 | \n", "13.336615 | \n", "10.149658 | \n", "-0.016936 | \n", "0.002702 | \n", "0.000667 | \n", "0.000013 | \n", "0.000509 | \n", "56117.140 | \n", "42272.740 | \n", "30286.500 | \n", "84.437530 | \n", "78.009740 | \n", "-5.427930 | \n", "-2.635981 | \n", "300.126465 | \n", "
849 | \n", "0.064975 | \n", "101438.690 | \n", "0.069100 | \n", "8.429897 | \n", "-192.28928 | \n", "13.679647 | \n", "10.164474 | \n", "-0.021005 | \n", "0.000413 | \n", "0.000406 | \n", "-0.000102 | \n", "0.000838 | \n", "56146.297 | \n", "42305.730 | \n", "30322.684 | \n", "84.389620 | \n", "78.030650 | \n", "-5.215088 | \n", "-2.612224 | \n", "300.126465 | \n", "
850 rows × 20 columns
\n", "