74
74
"metadata": {},
75
75
"outputs": [],
76
76
"source": [
77
- "formulae = Formulae(\n",
77
+ "FORMULAE = Formulae(\n",
78
78
" isotope_equilibrium_fractionation_factors='HoritaAndWesolowski1994',\n",
79
79
" isotope_meteoric_water_line='Dansgaard1964',\n",
80
80
" isotope_ratio_evolution='MerlivatAndJouzel1979',\n",
81
81
")\n",
82
- "BACKEND = CPU(formulae , override_jit_flags={'parallel': False})\n",
83
- "const = formulae .constants\n",
84
- "trivia = formulae .trivia\n",
82
+ "BACKEND = CPU(FORMULAE , override_jit_flags={'parallel': False})\n",
83
+ "CONST = FORMULAE .constants\n",
84
+ "TRIVIA = FORMULAE .trivia\n",
85
85
"\n",
86
86
"FIG4_CAPTION_PARAMS = {\n",
87
- " 'T_init': const .T0 + 25 * si.K,\n",
87
+ " 'T_init': CONST .T0 + 25 * si.K,\n",
88
88
" 'P_init': 1000 * si.mbar,\n",
89
- " 'RH_init': 80 * const .PER_CENT,\n",
89
+ " 'RH_init': 80 * CONST .PER_CENT,\n",
90
90
" # note: R0 in the caption, but negative, hence delta\n",
91
- " 'delta_2H_init': -74.7 * const .PER_MILLE,\n",
91
+ " 'delta_2H_init': -74.7 * CONST .PER_MILLE,\n",
92
92
" # the \"K\" parameter\n",
93
93
" 'isotope_exchange_factor': 1.,\n",
94
94
" # the \"N_L\" parameter, note: mixing ratio in the caption, but per-volume units, hence density; assuming 1 kg/m3\n",
95
95
" 'autoconversion_mixrat_threshold': 1 * si.g / si.m**3 / (1 * si.kg / si.m**3)\n",
96
96
"}\n",
97
97
"\n",
98
98
"ARBITRARY_PARAMS = {\n",
99
- " 'delta_18O_init': formulae .isotope_meteoric_water_line.d18O_of_d2H(\n",
99
+ " 'delta_18O_init': FORMULAE .isotope_meteoric_water_line.d18O_of_d2H(\n",
100
100
" delta_2H=FIG4_CAPTION_PARAMS['delta_2H_init']\n",
101
101
" ),\n",
102
102
" 'N_SUPER_DROPLETS': 1,\n",
106
106
"}\n",
107
107
"ARBITRARY_PARAMS['PARCEL_CTOR_ARGS'] = {\n",
108
108
" 'p0': FIG4_CAPTION_PARAMS['P_init'],\n",
109
- " 'initial_water_vapour_mixing_ratio': const .eps / ( # TODO #1207: use a physics formula \n",
109
+ " 'initial_water_vapour_mixing_ratio': CONST .eps / ( # TODO #1207: use a physics formula \n",
110
110
" FIG4_CAPTION_PARAMS['P_init']\n",
111
111
" / FIG4_CAPTION_PARAMS['RH_init']\n",
112
- " / formulae .saturation_vapour_pressure.pvs_water(FIG4_CAPTION_PARAMS['T_init'])\n",
112
+ " / FORMULAE .saturation_vapour_pressure.pvs_water(FIG4_CAPTION_PARAMS['T_init'])\n",
113
113
" - 1\n",
114
114
" ),\n",
115
115
" 'T0': FIG4_CAPTION_PARAMS['T_init'],\n",
162
162
" alpha_old = {}\n",
163
163
" dRv__dt = {}\n",
164
164
" for isotope in self.isotopes:\n",
165
- " alpha_fun = getattr(formulae.isotope_equilibrium_fractionation_factors, f'alpha_l_{isotope}')\n",
165
+ " alpha_fun = getattr(self.particulator. formulae.isotope_equilibrium_fractionation_factors, f'alpha_l_{isotope}')\n",
166
166
" alpha_old[isotope] = alpha_fun(self[\"T\"][0])\n",
167
167
" alpha_new = alpha_fun(self._tmp[\"T\"][0])\n",
168
168
" \n",
169
- " dRv__dt[isotope] = self[f'Rv_{isotope}'][0] * self.formulae.isotope_ratio_evolution.d_Rv_over_Rv(\n",
169
+ " dRv__dt[isotope] = self[f'Rv_{isotope}'][0] * self.particulator. formulae.isotope_ratio_evolution.d_Rv_over_Rv(\n",
170
170
" alpha=alpha_old[isotope],\n",
171
171
" d_alpha=(alpha_new - alpha_old[isotope]) / self.dt,\n",
172
172
" n_vapour=self['water_vapour_mixing_ratio'][0],\n",
231
231
" builder.add_dynamic(dynamics.Condensation())\n",
232
232
"\n",
233
233
" for isotope in isotopes:\n",
234
- " builder.particulator.environment[f\"Rv_{isotope}\"][:] = formulae.trivia .isotopic_delta_2_ratio(\n",
234
+ " builder.particulator.environment[f\"Rv_{isotope}\"][:] = TRIVIA .isotopic_delta_2_ratio(\n",
235
235
" delta=(FIG4_CAPTION_PARAMS if isotope == \"2H\" else ARBITRARY_PARAMS)[f'delta_{isotope}_init'],\n",
236
- " reference_ratio=getattr(const , f\"VSMOW_R_{isotope}\")\n",
236
+ " reference_ratio=getattr(CONST , f\"VSMOW_R_{isotope}\")\n",
237
237
" )\n",
238
238
" \n",
239
239
" super().__init__(particulator = builder.build(\n",
12223
12223
"PLOT_KEY = 'd'\n",
12224
12224
"print(output[PLOT_KEY][0]['Δz'])\n",
12225
12225
"\n",
12226
- "temp_C = output[PLOT_KEY][0][\"T\"] - const .T0\n",
12226
+ "temp_C = output[PLOT_KEY][0][\"T\"] - CONST .T0\n",
12227
12227
"alt_km = in_unit(output[PLOT_KEY][0][\"z\"], si.km) \n",
12228
12228
"\n",
12229
12229
"fig, axs = pyplot.subplots(2, 4, squeeze=False, sharey=True, figsize=(11.5, 11.5), tight_layout=True)\n",
12238
12238
"axs[0,0].yaxis.set_major_locator(ticker.MultipleLocator(5))\n",
12239
12239
"\n",
12240
12240
"axs[0,0].plot(\n",
12241
- " output[PLOT_KEY][0]['RH'] / const .PER_CENT,\n",
12241
+ " output[PLOT_KEY][0]['RH'] / CONST .PER_CENT,\n",
12242
12242
" temp_C,\n",
12243
12243
" color='purple',\n",
12244
12244
" label='RH',\n",
12277
12277
" (ARBITRARY_PARAMS['N_ITERATIONS']-1) // ARBITRARY_PARAMS['N_PLOT_PROFILES']\n",
12278
12278
" ):\n",
12279
12279
" deltas = {\n",
12280
- " iso: formulae.trivia .isotopic_ratio_2_delta(\n",
12280
+ " iso: TRIVIA .isotopic_ratio_2_delta(\n",
12281
12281
" ratio=output[PLOT_KEY][iteration][f'{ratio}_{iso}'][level_indices['CB']:],\n",
12282
- " reference_ratio=getattr(const , f\"VSMOW_R_{iso}\")\n",
12282
+ " reference_ratio=getattr(CONST , f\"VSMOW_R_{iso}\")\n",
12283
12283
" ) for iso in ISOTOPES\n",
12284
12284
" }\n",
12285
12285
" \n",
@@ -12292,15 +12292,15 @@
12292
12292
" for ax, iso, color in ((axs[plot_row, 1], '2H', 'green'), (axs[plot_row, 2], \"18O\", 'brown')):\n",
12293
12293
" ax.set_title(title)\n",
12294
12294
" ax.plot(\n",
12295
- " in_unit(deltas[iso], const .PER_MILLE),\n",
12295
+ " in_unit(deltas[iso], CONST .PER_MILLE),\n",
12296
12296
" temp_C[level_indices['CB']:],\n",
12297
12297
" color=color,\n",
12298
12298
" **iter_kwargs\n",
12299
12299
" )\n",
12300
12300
" axs[plot_row, 3].plot(\n",
12301
12301
" in_unit(\n",
12302
- " formulae .isotope_meteoric_water_line.excess_d(delta_2H=deltas[\"2H\"], delta_18O=deltas[\"18O\"]),\n",
12303
- " const .PER_MILLE\n",
12302
+ " FORMULAE .isotope_meteoric_water_line.excess_d(delta_2H=deltas[\"2H\"], delta_18O=deltas[\"18O\"]),\n",
12303
+ " CONST .PER_MILLE\n",
12304
12304
" ),\n",
12305
12305
" temp_C[level_indices['CB']:],\n",
12306
12306
" color='black',\n",
@@ -14719,19 +14719,19 @@
14719
14719
" colors = {'vapour': 'red', 'rain': 'blue'}\n",
14720
14720
" linewidth = 1 + .5 * PARAMS_KEYS.index(key)\n",
14721
14721
" line_v = axs.plot(\n",
14722
- " in_unit(formulae.trivia .isotopic_ratio_2_delta(\n",
14722
+ " in_unit(TRIVIA .isotopic_ratio_2_delta(\n",
14723
14723
" ratio=data[key]['CT'][\"Rv_2H\"][1:],\n",
14724
- " reference_ratio=const .VSMOW_R_2H\n",
14725
- " ), const .PER_MILLE),\n",
14724
+ " reference_ratio=CONST .VSMOW_R_2H\n",
14725
+ " ), CONST .PER_MILLE),\n",
14726
14726
" label=f\"vapour at the cloud top ({in_unit(levels['CT'], si.km)} km)\",\n",
14727
14727
" color=colors['vapour'],\n",
14728
14728
" linewidth=linewidth\n",
14729
14729
" )\n",
14730
14730
"\n",
14731
- " rain_data = in_unit(formulae.trivia .isotopic_ratio_2_delta(\n",
14731
+ " rain_data = in_unit(TRIVIA .isotopic_ratio_2_delta(\n",
14732
14732
" ratio=data[key]['CB'][\"Rr_2H\"][1:],\n",
14733
- " reference_ratio=const .VSMOW_R_2H\n",
14734
- " ), const .PER_MILLE)\n",
14733
+ " reference_ratio=CONST .VSMOW_R_2H\n",
14734
+ " ), CONST .PER_MILLE)\n",
14735
14735
" line_r = twinx.plot(\n",
14736
14736
" rain_data,\n",
14737
14737
" label=f\"rain at the cloud base ({in_unit(levels['CB'], si.km)} km)\",\n",
0 commit comments