@ -67,6 +67,7 @@
@@ -67,6 +67,7 @@
"metadata": {},
"outputs": [],
"source": [
"# area factors for different latitudes\n",
"area_factor = (\n",
" np.cos(np.arange(180) * np.pi / 180) - \n",
" np.cos(np.arange(1, 181) * np.pi / 180)\n",
@ -196,6 +197,7 @@
@@ -196,6 +197,7 @@
"metadata": {},
"outputs": [],
"source": [
"# numbers of simulated days for analysis\n",
"wrf_N_days = 4992\n",
"inm_N_days = 3650"
]
@ -207,6 +209,9 @@
@@ -207,6 +209,9 @@
"metadata": {},
"outputs": [],
"source": [
"# dates corresponding to the indices (0 axis) of the data arrays\n",
"# note: for WRF dates correspond to real dates\n",
"\n",
"wrf_dt_indicies = np.array(\n",
" [dt.date(1980, 1, 1) + dt.timedelta(i * 3) for i in range(wrf_N_days)]\n",
")\n",
@ -229,20 +234,31 @@
@@ -229,20 +234,31 @@
},
"outputs": [],
"source": [
"# dictionaries where processed data is saved. The dictionary keys represent the\n",
"# threshold value of CAPE - integer numbers from the list 500, 800, 1000, 1200,\n",
"# where the key 500 relates only to temperature-based modeling and is present \n",
"# only in dictionaries wrf_<...>, while keys 800, 1000, 1200 correspond to \n",
"# classical modeling using the WRF or INMCM model.\n",
"\n",
"# averaged air temperature at the height of 2 meter with the shape (180, 12)\n",
"wrf_LATxMON_t2 = np.load(\"./data/WRF/WRF_T2_LATxMON.npy\")\n",
"\n",
"# summed WRF IP along longitudes and averaged over months with shape (180, 12)\n",
"wrf_LATxMON_ip = {\n",
" key: np.load(f\"./data/WRF/WRF_IP_{parameters}_LATxMON.npy\")\n",
" for key, parameters in zip([500, 800, 1000, 1200],\n",
" [\"500_T2_25\", \"800\", \"1000\", \"1200\"])\n",
"}\n",
"\n",
"# the same for INMCM\n",
"inm_LATxMON_ip = {\n",
" key: np.load(f\"./data/INMCM/INMCM_IP_{parameters}_LATxMON.npy\")\n",
" for key, parameters in zip([800, 1000, 1200],\n",
" [\"800\", \"1000\", \"1200\"])\n",
"}\n",
"\n",
"# dict contains arrays with dimensions (4992, 24)\n",
"# where axis 0 contains the day index (see `wrf_dt_indicies`)\n",
"wrf_hourly_total_ip = {\n",
" key: np.load(f\"./data/WRF/WRF_HOURLY_TOTAL_IP_{parameters}.npy\")[:wrf_N_days]\n",
" for key, parameters in zip([500, 800, 1000, 1200],\n",
@ -313,23 +329,39 @@
@@ -313,23 +329,39 @@
"source": [
"# calculate the average contribution of the regions to \n",
"# the ionospheric potential (as % of total IP)\n",
"# for specific regions, models and parameters CAPE / T2 \n",
"# for specific latitudinal bands and parameterizations \n",
"\n",
"# select the latitudinal bands for analysis\n",
"band_names = [\"9S-9N\", \"18S-18N\", \"30S-30N\"]\n",
"wrf_bands = [LatitudeBand(t, model=\"WRF\") for t in band_names]\n",
"inmcm_bands = [LatitudeBand(t, model=\"INMCM\") for t in band_names]\n",
" \n",
"\n",
"print(\"Model | CAPE | T2,°C | Band | % \")\n",
"\n",
"# iterate over the latitude bands selected above\n",
"for i, (wrf_band, inm_band) in enumerate(zip(wrf_bands, inmcm_bands)):\n",
" print(\"-\"*41)\n",
"\n",
" # we will analyze all parameterizations only in the 9N-9S band; in the \n",
" # other bands, we will consider only the parameterization with CAPE = 1000\n",
" capes = [1000]\n",
" if i == 0:\n",
" capes = [500, 800, 1000, 1200]\n",
"\n",
" # iterate over different parameterizations\n",
" for cape in capes:\n",
" # calculation of the seasonal variation of contribution to IP \n",
" # from i-nth band -> array (12,)\n",
" wrf_ip_MON = wrf_LATxMON_ip[cape][wrf_band.slice].sum(axis=0)\n",
"\n",
" # calculation of the contribution of the n-th band \n",
" # to the total IP in percentage -> single value\n",
" wrf_share = (wrf_ip_MON*wrf_numdays).sum() / wrf_numdays.sum() / 240e3 * 100\n",
" # note: The averaging by months takes into account the number of \n",
" # days taken from the original series for each month, as direct \n",
" # averaging may lead to a slight error\n",
"\n",
" # the same for INMCM\n",
" if cape != 500:\n",
" inm_ip_MIN = inm_LATxMON_ip[cape][inm_band.slice].sum(axis=0)\n",
" inm_share = (inm_ip_MIN*inm_numdays).sum() / inm_numdays.sum() / 240e3 * 100\n",
@ -384,26 +416,46 @@
@@ -384,26 +416,46 @@
}
],
"source": [
"# calculation of: \n",
"# (i) the positions of the extrema of the seasonal \n",
"# variation of the contribution to IP from \n",
"# individual latitudinal bands,\n",
"# (ii) the amplitudes of the peak-to-peak amplitudes \n",
"# of the seasonal variation <-//->,\n",
"# for different parameterizations\n",
"\n",
"# select the latitudinal bands for analysis\n",
"band_names = [\"90S-9S\", \"9S-9N\", \"9N-90N\"]\n",
"wrf_bands = [LatitudeBand(t, model=\"WRF\") for t in band_names]\n",
"inmcm_bands = [LatitudeBand(t, model=\"INMCM\") for t in band_names]\n",
"\n",
"print(\"Model | CAPE | T2,°C | Band | Min | Max | Peak-to-peak, %\")\n",
"\n",
"# iterate over the latitude bands selected above\n",
"for i, (wrf_band, inm_band) in enumerate(zip(wrf_bands, inmcm_bands)):\n",
" print(\"-\"*63)\n",
" for cape in [500, 800, 1000, 1200]:\n",
" \n",
" # calculation of the seasonal variation of contribution to IP \n",
" # from i-nth band -> array (12,)\n",
" seas_var = wrf_LATxMON_ip[cape][wrf_band.slice].sum(axis=0)\n",
"\n",
" # calculation of the positions of the extrema\n",
" month_min = month_name_3[np.argmin(seas_var)]\n",
" month_max = month_name_3[np.argmax(seas_var)]\n",
"\n",
" # calculation of the peak-to-peak amplitude of the seasonal variation\n",
" pk_pk_ampl = (seas_var.max() - seas_var.min())/seas_var.mean() * 100\n",
"\n",
" # the same for INMCM\n",
" if cape != 500:\n",
" seas_var = inm_LATxMON_ip[cape][inm_band.slice].sum(axis=0) \n",
" month_min = month_name_3[np.argmin(seas_var)]\n",
" month_max = month_name_3[np.argmax(seas_var)]\n",
" pk_pk_ampl = (seas_var.max() - seas_var.min())/seas_var.mean() * 100\n",
"\n",
" print(f\"INMCM | {cape:4} | - |{inm_band.label:>11} | {month_min} | {month_max} | {pk_pk_ampl:>6.2f}%\")\n",
" \n",
" seas_var = wrf_LATxMON_ip[cape][wrf_band.slice].sum(axis=0)\n",
" month_min = month_name_3[np.argmin(seas_var)]\n",
" month_max = month_name_3[np.argmax(seas_var)]\n",
" pk_pk_ampl = (seas_var.max() - seas_var.min())/seas_var.mean() * 100\n",
" \n",
"\n",
" p = \"25 \" if cape == 500 else \"- \"\n",
" print(f\"WRF | {cape:4} | {p:<5} |{inm_band.label:>11} | {month_min} | {month_max} | {pk_pk_ampl:>6.2f}%\")"
]
@ -449,19 +501,27 @@
@@ -449,19 +501,27 @@
}
],
"source": [
"# calculation of the maximum values of the contribution\n",
"# to IP from latitudinal bands, calculation is needed for \n",
"# manual refinement of the figure boundaries.\n",
"\n",
"# select the latitudinal bands for analysis\n",
"band_names = [\"18N-90N\", \"9N-18N\", \"0-9N\", \"0-9S\", \"9S-18S\", \"18S-90S\"]\n",
"wrf_bands = [LatitudeBand(t, model=\"WRF\") for t in band_names]\n",
"inmcm_bands = [LatitudeBand(t, model=\"INMCM\") for t in band_names]\n",
"\n",
"print(\"CAPE = 1000 J/kg\\n\")\n",
"print(\"Model | Band | Max IP contrib.\")\n",
"\n",
"# iterate over the latitude bands selected above\n",
"for i, (wrf_band, inm_band) in enumerate(zip(wrf_bands, inmcm_bands)):\n",
" print(\"-\"*31)\n",
"\n",
" # calculation of the maximum (over months axis) values, V\n",
" wrf_max = wrf_LATxMON_ip[1000][wrf_band.slice].sum(axis=0).max()\n",
" inm_max = inm_LATxMON_ip[1000][inm_band.slice].sum(axis=0).max()\n",
" print(f\"WRF | {wrf_band.label:>9} | {wrf_max:>9.2f} V\")\n",
" print(f\"INMCM | {inm_band.label:>9} | {inm_max:>9.2f} V\")\n",
" # inm_LATxMON_ip[1000]"
" print(f\"INMCM | {inm_band.label:>9} | {inm_max:>9.2f} V\")"
]
},
{
@ -492,12 +552,22 @@
@@ -492,12 +552,22 @@
}
],
"source": [
"# calculation of the maximum and minimum values of the temperature at the\n",
"# 2-meter level in each latitude band. The temperature is averaged over \n",
"# spatial cells within each band. Calculation is needed for manual \n",
"# refinement of the figure boundaries.\n",
"\n",
"# select the latitudinal bands for analysis\n",
"band_names = [\"18N-30N\", \"9N-18N\", \"0-9N\", \"0-9S\", \"9S-18S\", \"18S-30S\"]\n",
"wrf_bands = [LatitudeBand(t, model=\"WRF\") for t in band_names]\n",
"\n",
"print(\"Model | Band | Min T2 | Max T2\")\n",
"print(\"-\" * 37)\n",
"\n",
"# iterate over the latitude bands selected above\n",
"for wrf_band in wrf_bands:\n",
"\n",
" # averaging is performed with consideration of the area factor\n",
" tmp_t2 = (\n",
" wrf_LATxMON_t2[wrf_band.slice] * area_factor[wrf_band.slice, np.newaxis]\n",
" ).sum(axis=0) / area_factor[wrf_band.slice, np.newaxis].sum()\n",
@ -526,6 +596,7 @@
@@ -526,6 +596,7 @@
"metadata": {},
"outputs": [],
"source": [
"# select the latitudinal bands for analysis\n",
"band_names = [\"0-9N\", \"0-9S\", \"9S-18S\", \"18S-90S\", \"9N-18N\", \"18N-90N\"]\n",
"wrf_bands = [LatitudeBand(t, model=\"WRF\") for t in band_names]\n",
"inmcm_bands = [LatitudeBand(t, model=\"INMCM\") for t in band_names]\n",
@ -660,6 +731,7 @@
@@ -660,6 +731,7 @@
"metadata": {},
"outputs": [],
"source": [
"# select the latitudinal bands for analysis\n",
"band_names = [\"18N-90N\", \"9N-18N\", \"0-9N\", \"0-9S\", \"9S-18S\", \"18S-90S\"]\n",
"\n",
"wrf_bands = [LatitudeBand(t, model=\"WRF\") for t in band_names]\n",
@ -964,11 +1036,6 @@
@@ -964,11 +1036,6 @@
"axM.set_title('Partition of the Earth’s surface into regions',\n",
" fontsize='large', pad=10)\n",
"\n",
"\n",
"#####################\n",
"### Plotting data ###\n",
"#####################\n",
"\n",
"for j in range(6):\n",
" ax[2*j].bar(range(12), wrf_ip_sum_over_bands[j],\n",
" 0.8, color=wrf_bands[j].color)\n",
@ -1087,6 +1154,7 @@
@@ -1087,6 +1154,7 @@
"metadata": {},
"outputs": [],
"source": [
"# select the latitudinal bands for analysis\n",
"band_names = [\"0-9N\", \"0-9S\", \"9S-18S\", \"18S-90S\", \"9N-18N\", \"18N-90N\"]\n",
"wrf_bands = [LatitudeBand(t, model=\"WRF\") for t in band_names]\n",
"inmcm_bands = [LatitudeBand(t, model=\"INMCM\") for t in band_names]\n",