Skip to content

Commit ae1e9d5

Browse files
authored
Merge pull request #190 from esowc/branch-alba
Rename component_mol_weight to component_MW
2 parents 3135ffe + 57084d3 commit ae1e9d5

File tree

10 files changed

+95
-96
lines changed

10 files changed

+95
-96
lines changed

functions/functions_cams.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -662,21 +662,21 @@
662662
"metadata": {},
663663
"outputs": [],
664664
"source": [
665-
"def CAMS_kg_m2_to_molecules_cm2(CAMS_ds, component_mol_weight):\n",
665+
"def CAMS_kg_m2_to_molecules_cm2(CAMS_ds, component_MW):\n",
666666
"\n",
667667
" \"\"\" Convert the units of the CAMS dataset for any component from kg/m2 to molecules/cm2\n",
668668
"\n",
669669
" Args:\n",
670670
" CAMS_ds (xarray): CAMS levels dataset in xarray format\n",
671-
" component_mol_weight (float): Component molecular weight\n",
671+
" component_MW (float): Component molecular weight\n",
672672
"\n",
673673
" Returns:\n",
674674
" CAMS_ds (xarray): CAMS levels dataset in xarray format\n",
675675
" \"\"\"\n",
676676
"\n",
677677
" # Convert units from kg/m2 to molecules/cm2\n",
678678
" NA = 6.022*10**23\n",
679-
" CAMS_ds['component'] = (CAMS_ds['component'] * NA * 1000) / (10000 * component_mol_weight)\n",
679+
" CAMS_ds['component'] = (CAMS_ds['component'] * NA * 1000) / (10000 * component_MW)\n",
680680
" \n",
681681
" return CAMS_ds"
682682
]

functions/functions_general.ipynb

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
"\n",
100100
" Returns:\n",
101101
" component (str): Component name\n",
102-
" component_mol_weight (float): Component molecular weight\n",
102+
" component_MW (float): Component molecular weight\n",
103103
" component_sensor_product (str): Component product name in TROPOMI, IASI or GOME-2 database\n",
104104
" sensor_column (str): Component column name in TROPOMI, IASI or GOME-2 database\n",
105105
" column_type (str): Tropospheric or total column\n",
@@ -111,8 +111,7 @@
111111
"\n",
112112
" component_col = ['nitrogen_dioxide', 'carbon_monoxide', 'ozone', 'sulphur_dioxide', \n",
113113
" 'methane', 'formaldehyde', 'ammonia']\n",
114-
" component_mol_weight_col = [46.005, 28.01, 48, 64.066, \n",
115-
" 16.04, 30.031, 17.031]\n",
114+
" component_MW_col = [46.005, 28.01, 48, 64.066, 16.04, 30.031, 17.031]\n",
116115
" component_tropomi_L3_column_col = ['NO2trop', '-', '-', '-', '-', '-', '-']\n",
117116
" component_tropomi_L2_column_col = ['nitrogendioxide_tropospheric_column', \n",
118117
" 'carbonmonoxide_total_column', \n",
@@ -130,7 +129,7 @@
130129
" component_gome_L2_column_col = ['NO2trop', '-', 'O3total', 'SO2total', '-', 'HCHOtotal', '-']\n",
131130
"\n",
132131
" rows = {'Nomenclature': component_nom_col, \n",
133-
" 'Weight': component_mol_weight_col,\n",
132+
" 'Weight': component_MW_col,\n",
134133
" 'Component': component_col, \n",
135134
" 'TROPOMI_L3_column': component_tropomi_L3_column_col,\n",
136135
" 'TROPOMI_L2_product': component_tropomi_L2_product_col,\n",
@@ -143,7 +142,7 @@
143142
" components_table = pd.DataFrame(rows)\n",
144143
"\n",
145144
" component = components_table['Component'].loc[components_table['Nomenclature'] == component_nom].iloc[0]\n",
146-
" component_mol_weight = components_table['Weight'].loc[components_table['Nomenclature'] == component_nom].iloc[0]\n",
145+
" component_MW = components_table['Weight'].loc[components_table['Nomenclature'] == component_nom].iloc[0]\n",
147146
" \n",
148147
" if sensor == 'tropomi' and sensor_type == 'L2':\n",
149148
" sensor_product_type = components_table['TROPOMI_L2_product'].loc[components_table['Nomenclature'] == component_nom].iloc[0]\n",
@@ -156,7 +155,7 @@
156155
" else:\n",
157156
" column_type = 'total'\n",
158157
"\n",
159-
" return component, component_mol_weight, sensor_product_type, sensor_column, column_type"
158+
" return component, component_MW, sensor_product_type, sensor_column, column_type"
160159
]
161160
},
162161
{
@@ -495,7 +494,7 @@
495494
"metadata": {},
496495
"outputs": [],
497496
"source": [
498-
"def model_convert_units(model, model_ds, sensor, component_mol_weight, model_levels_df, \n",
497+
"def model_convert_units(model, model_ds, sensor, component_MW, model_levels_df, \n",
499498
" start_date, end_date, component_nom, apply_kernels = False, \n",
500499
" CAMS_UID = None, CAMS_key = None):\n",
501500
"\n",
@@ -505,7 +504,7 @@
505504
" model (str): Name of the model\n",
506505
" model_ds (xarray): model dataset in xarray format (CAMS)\n",
507506
" sensor (str): Name of the sensor\n",
508-
" component_mol_weight (float): Component molecular weight\n",
507+
" component_MW (float): Component molecular weight\n",
509508
" model_levels_df (dataframe): Table with 137 CAMS levels data\n",
510509
" start_date (str): Query start date\n",
511510
" end_date (str): Query end date\n",
@@ -530,7 +529,7 @@
530529
"\n",
531530
" if model_ds.component.units == 'kg m**-2':\n",
532531
"\n",
533-
" model_ds = CAMS_kg_m2_to_molecules_cm2(model_ds, component_mol_weight)\n",
532+
" model_ds = CAMS_kg_m2_to_molecules_cm2(model_ds, component_MW)\n",
534533
" units = 'molec cm-2'\n",
535534
" model_ds['component'] = model_ds.component.assign_attrs({'units': units})\n",
536535
" print('The model component units have been converted from kg m**-2 to molec cm-2.')\n",

main_cams_gome_L2.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
"comparison_check(sensor, model, component_nom, model_full_name, sensor_type, apply_kernels)\n",
157157
"\n",
158158
"# Get component full name and molecular weight\n",
159-
"component, component_mol_weight, product_type, sensor_column, column_type = components_table(sensor, component_nom, sensor_type)\n",
159+
"component, component_MW, product_type, sensor_column, column_type = components_table(sensor, component_nom, sensor_type)\n",
160160
"\n",
161161
"# Folders generation\n",
162162
"generate_folders(model, sensor, component_nom, sensor_type)"
@@ -929,7 +929,7 @@
929929
],
930930
"source": [
931931
"model_ds, units = model_convert_units(model, model_ds, sensor, \n",
932-
" component_mol_weight, model_levels_df,\n",
932+
" component_MW, model_levels_df,\n",
933933
" start_date, end_date, component_nom, apply_kernels,\n",
934934
" CAMS_UID = None, CAMS_key = None)"
935935
]

main_cams_gome_L3.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@
161161
"comparison_check(sensor, model, component_nom, model_full_name, sensor_type, apply_kernels)\n",
162162
"\n",
163163
"# Get component full name and molecular weight\n",
164-
"component, component_mol_weight, product_type, sensor_column, column_type = components_table(sensor, component_nom, sensor_type)\n",
164+
"component, component_MW, product_type, sensor_column, column_type = components_table(sensor, component_nom, sensor_type)\n",
165165
"\n",
166166
"# Folders generation\n",
167167
"generate_folders(model, sensor, component_nom, sensor_type)"
@@ -710,7 +710,7 @@
710710
],
711711
"source": [
712712
"model_ds, units = model_convert_units(model, model_ds, sensor, \n",
713-
" component_mol_weight, model_levels_df,\n",
713+
" component_MW, model_levels_df,\n",
714714
" start_date, end_date, component_nom, apply_kernels,\n",
715715
" CAMS_UID = None, CAMS_key = None)"
716716
]

0 commit comments

Comments
 (0)