Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop_aircraft into develop #253

Merged
merged 77 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
98b4f28
Add basic pairing for aircraft observations
colin-harkins Aug 23, 2022
351bc88
Add newline end of tools.py and import only vert_interp
colin-harkins Aug 25, 2022
d0c8d54
Change resample to occur in observation class and add ability to repl…
colin-harkins Sep 20, 2022
b8d1508
Merge pull request #101 from colin-harkins/develop_aircraft
rschwant Sep 27, 2022
3a0305d
Merge new features from develop
colin-harkins Mar 15, 2023
d016076
Merge pull request #171 from colin-harkins/develop_aircraft
colin-harkins Mar 16, 2023
c25c33d
Add reading aircraft obs from .csv file
colin-harkins Mar 29, 2023
a173347
Add newline to file
colin-harkins Mar 29, 2023
f523245
Fix newline
colin-harkins Mar 29, 2023
7adc3af
Merge pull request #172 from colin-harkins/develop_aircraft
colin-harkins Apr 24, 2023
7ede115
Update tools.py to work with new stratify version
colin-harkins May 19, 2023
5dfbb9a
Update resample_stratify function in tools.py to work with new strati…
May 19, 2023
32a1153
Merge pull request #178 from colin-harkins/develop_aircraft
colin-harkins May 19, 2023
90d5e55
Merge branch 'develop_aircraft' of github.com:quaz115/MELODIES-MONET …
May 20, 2023
ef27b58
Draft PR (changes for review/edit) for Vertical Profile (in progress)…
Jun 17, 2023
d4921a4
Draft PR for review (plots/__init__.py)
quaz115 Jun 17, 2023
e83098d
Vertical Profile plots generated with these changes, legends yet to b…
quaz115 Jun 18, 2023
f2cc261
Add functionality for pairing to mobile ground data and control file …
colin-harkins Jul 13, 2023
750ce80
Add single ground site pairing
colin-harkins Jul 14, 2023
a358020
Update control_hrrr-smoke_mobile.yaml
colin-harkins Jul 18, 2023
c07bc3d
Update control_wrfchem_ground.yaml
colin-harkins Jul 18, 2023
73b16bd
Update driver.py
colin-harkins Jul 18, 2023
02e096d
import functions from surfplots instead of duplicating in aircraftplo…
quaz115 Aug 7, 2023
2f5cdec
Time-Series now has 'Altitude' as secondary axis for develop_aircraft…
quaz115 Aug 8, 2023
b0e57f7
Vertical profile plots (Legend also revised) now have option via inte…
quaz115 Aug 9, 2023
372d3ce
Minor update to format Vertical plot y-axis (altitude) labels to be r…
quaz115 Aug 9, 2023
dd6a9eb
Function to add Altitude variable as secondary y-axis to Timeseries n…
quaz115 Aug 9, 2023
a9d893d
Subset ability as per secondary y-axis for alttiude_variable added fo…
quaz115 Aug 9, 2023
28a5c80
Renamed .py and .ipynb for Latest develop_aircraft WRF-Chem example c…
quaz115 Aug 16, 2023
1d37352
Updated ../examples/yaml/ path in develop_aircraft WRF-Chem example J…
quaz115 Aug 16, 2023
33e5c9d
Updated ../examples/yaml/ path in develop_aircraft WRF-Chem example .…
quaz115 Aug 16, 2023
2c27538
Update (removed obsolete commented line) melodies_monet/plots/aircra…
quaz115 Aug 16, 2023
31418f0
Legend Text specific to Box-Whisker: Update melodies_monet/plots/airc…
quaz115 Aug 16, 2023
f66cc31
Updated (TO DO: add Pressure as altitude_variable) control_wrfchem_ai…
quaz115 Aug 18, 2023
10d981f
NEW add_yax2_altitude function to use control list 'altitude_yax2' an…
quaz115 Aug 21, 2023
c949edc
New altitude_yax2 control list to control secondary y-axis (altitude)…
quaz115 Aug 21, 2023
3caedbe
Changes in call to add_yax2_altitude (filter_dict used for subsetting…
quaz115 Aug 21, 2023
e25c3df
YAML altitude_yax2 'filter_dict' update to specify flexibility to mak…
quaz115 Aug 26, 2023
942716b
Update in driver.py, to accomodate the add_yax2_altitude() to specify…
quaz115 Aug 26, 2023
1265625
Update in aircraftplots.py for accommodating the option for filter_di…
quaz115 Aug 26, 2023
f757a86
Merge pull request #181 from quaz115/develop_aircraft
quaz115 Aug 28, 2023
6070c7e
Merge pull request #185 from colin-harkins/develop_aircraft
colin-harkins Aug 29, 2023
499c3b7
Scatter plot (matplolib) or scatter density kde fill (seaborn) plot c…
quaz115 Aug 30, 2023
d23c12e
Violin Plots capability added for develop_aircraft
quaz115 Sep 5, 2023
842a2f3
Changes (minor) relevant to pandas update for groupby function in air…
quaz115 Sep 9, 2023
2dbaea4
Update driver.py for resolving conflict in make_timeseries to work wi…
quaz115 Oct 26, 2023
1e8df10
Updates in driver.py, removing commented statements and added elif co…
quaz115 Jan 2, 2024
5edd225
Violin plot resolved for multiple models, scatter plot also generated…
quaz115 Jan 11, 2024
fc356e6
Multiple model groups versus obs develop+aircraft YAML example
quaz115 Jan 11, 2024
f0170c8
aircraftplots.py cleanup and fix to remove FutureWarning
quaz115 Feb 12, 2024
2712e90
All driver.py cleanup and minor fixes done
quaz115 Feb 12, 2024
d740ea9
Merge pull request #189 from quaz115/develop_aircraft
colin-harkins Feb 12, 2024
b238ffe
Merge develop branch into develop_aircraft and resolve conflicts
colin-harkins Feb 13, 2024
8c802bd
Correct error caused for non-aircraft timeseries plots by change in P…
colin-harkins Feb 13, 2024
bbe2fb0
Fix FutureWarning from sns.boxplot() in .plots.surfplots
colin-harkins Feb 14, 2024
0435bf4
Fix warning about rem_obs_nan for aircraft, ground and mobile.
colin-harkins Feb 14, 2024
c40d048
Fix warning related to using inplace method for aircraft vert interpo…
colin-harkins Feb 14, 2024
ad03db6
Fix if statement from prior commit related to rem_obs_nan
colin-harkins Feb 14, 2024
7c70cf3
Merge pull request #248 from colin-harkins/develop_aircraft
colin-harkins Feb 14, 2024
5adc556
Add tool to loop over sets of pairings, saving out a netcdf for each
colin-harkins Feb 15, 2024
f124b52
Clean up a few things
colin-harkins Feb 15, 2024
728c873
Resolve issues with illegal characters in netcdf4 variable names.
colin-harkins Feb 20, 2024
5f8268c
Add yaml for sets of aircraft pairings
colin-harkins Mar 13, 2024
35fb1fd
Make start_time and end_time optional, remove other optional settings…
colin-harkins Mar 13, 2024
5843b17
Add example file for running on hera
colin-harkins Mar 13, 2024
c6262b6
Add example for reading in saved files from looping aircraft code
colin-harkins Mar 14, 2024
6ef5e75
Remove extra lines from notebook
colin-harkins Mar 14, 2024
8567a0c
Fix jupyter notebook being way larger than it should be
colin-harkins Mar 15, 2024
44b1b03
Merge pull request #250 from colin-harkins/develop_aircraft
colin-harkins Mar 18, 2024
a62bf09
Update header of aircraftplots.py
colin-harkins Mar 18, 2024
f088c21
Update header of loop_pairing.py
colin-harkins Mar 18, 2024
9de372d
Update header of loop_pairing function again
colin-harkins Mar 18, 2024
9b8a328
Update loop_pairing header another time
colin-harkins Mar 18, 2024
c50bb90
test another fix to header of loop_pairing
colin-harkins Mar 18, 2024
824dfd4
test adding in file_pairs example again to loop_pairing
colin-harkins Mar 18, 2024
c61f404
revert to functional docstring for loop_pairing
colin-harkins Mar 18, 2024
3935b64
Fix issue with example in loop_pairing
colin-harkins Mar 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from melodies_monet import driver

an = driver.analysis()

an.control = '../examples/yaml/control_wrfchem_aircraft_Latestfor_develop_aircraft.yaml'

an.read_control()

an.control_dict

an.open_models()

an.open_obs()

#This just pairs the data
an.pair_data()

an.plotting()
1,532 changes: 1,532 additions & 0 deletions examples/jupyter_notebooks/Monet-example_aircraft_pairing_loop.ipynb

Large diffs are not rendered by default.

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions examples/submit_jobs/run_aircraft_pairing_loop.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# This code uses MELODIES-MONET to read in a .yaml file
# and produces sets of paired aircraft observations.
# For an interactive script see jupyter notebooks in main directory.

from melodies_monet import driver
from melodies_monet.util.tools import loop_pairing
import os
import dask
an = driver.analysis()
# -- Update the yaml file below
control_fn = '../yaml/control_aircraft_looping.yaml'
file_pairs_yaml='../yaml/supplementary_yaml/aircraft_looping_file_pairs.yaml'
an.control = control_fn
an.read_control()

# -- Lines below make a copy of the namelist in the plot directory for reference later
cmd = 'cp ' + an.control + ' ' + an.control_dict['analysis']['output_dir']
os.system(cmd)

cmd = 'cp ' + file_pairs_yaml + ' ' + an.control_dict['analysis']['output_dir']
os.system(cmd)

dask.config.set(**{'array.slicing.split_large_chunks': True})
loop_pairing(control=control_fn,file_pairs_yaml=file_pairs_yaml)

88 changes: 88 additions & 0 deletions examples/yaml/control_aircraft_looping.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# General Description:
# Any key that is specific for a plot type will begin with ts for timeseries, ty for taylor
# Opt: Specifying the variable or variable group is optional
# For now all plots except time series average over the analysis window.
# Seting axis values - If set_axis = True in data_proc section of each plot_grp the yaxis for the plot will be set based on the values specified in the obs section for each variable. If set_axis is set to False, then defaults will be used. 'vmin_plot' and 'vmax_plot' are needed for 'timeseries', 'spatial_overlay', and 'boxplot'. 'vdiff_plot' is needed for 'spatial_bias' plots and'ty_scale' is needed for 'taylor' plots. 'nlevels' or the number of levels used in the contour plot can also optionally be provided for spatial_overlay plot. If set_axis = True and the proper limits are not provided in the obs section, a warning will print, and the plot will be created using the default limits.
analysis:
#start_time: '2019-09-05-12:00:00' #UTC
#end_time: '2019-09-06-00:00:00' #UTC
output_dir: /wrk/charkins/melodies_monet/aircraft/develop_aircraft_looping/output #/wrk/charkins/melodies_monet/aircraft/analysis #Opt if not specified plots stored in code directory.
debug: True

model:
wrfchem_v4.2: # model label
mod_type: 'wrfchem'
mod_kwargs:
mech: 'racm_esrl_vcp'
radius_of_influence: 12000 #meters
mapping: #model species name : obs species name
firexaq:
no2: NO2_CL_RYERSON
'no': 'NO_CL_RYERSON'
#PM2_5_DRY: "PM2.5"
o3: "O3_CL_RYERSON"
variables:
'pres_pa_mid':
rename: pressure_model # name to convert this variable to, use 'pressure_model' for aircraft obs
unit_scale: 1 #Opt Scaling factor
unit_scale_method: '*' #Opt Multiply = '*' , Add = '+', subtract = '-', divide = '/'
'temperature_k':
rename: temp_model # name to convert this variable to
unit_scale: 1 #Opt Scaling factor
unit_scale_method: '*' #Opt Multiply = '*' , Add = '+', subtract = '-', divide = '/'
projection: null
#plot_kwargs: #Opt
# color: 'dodgerblue'
# marker: '^'
# linestyle: ':'
obs:
firexaq: # obs label
obs_type: aircraft
resample: '600S' #'600S' #10 min so works on Hera as a test. Can comment this if submitting a job.
variables: #Opt
'O3_CL_RYERSON':
unit_scale: 1 #Opt Scaling factor
unit_scale_method: '*' #Opt Multiply = '*' , Add = '+', subtract = '-', divide = '/'
nan_value: -777777 # Opt Set this value to NaN
LLOD_value: -888888 # Opt Set this value to LLOD_setvalue
LLOD_setvalue: 0.0 # Opt Set LLOD_value=LLOD_setvalue, applied AFTER unit_scale and obs_unit
#ylabel_plot: 'Ozone (ppbv)'
#vmin_plot: 15.0 #Opt Min for y-axis during plotting. To apply to a plot, change restrict_yaxis = True.
#vmax_plot: 55.0 #Opt Max for y-axis during plotting. To apply to a plot, change restrict_yaxis = True.
#vdiff_plot: 20.0 #Opt +/- range to use in bias plots. To apply to a plot, change restrict_yaxis = True.
# nlevels_plot: 21 #Opt number of levels used in colorbar for contourf plot.
'NO_CL_RYERSON':
nan_value: -777777 # Set this value to NaN
LLOD_value: -888888 # Opt Set this value to LLOD_setvalue
LLOD_setvalue: 0.0 # Opt Set LLOD_value=LLOD_setvalue, applied AFTER unit_scale and obs_unit
#ylabel_plot: 'NO (ppbv)' #Optional to set ylabel so can include units and/or instr etc.
#vmin_plot: 0.0 #Opt Min for y-axis during plotting. To apply to a plot, change restrict_yaxis = True.
#vmax_plot: 20.0 #Opt Max for y-axis during plotting. To apply to a plot, change restrict_yaxis = True.
#vdiff_plot: 15.0 #Opt +/- range to use in bias plots. To apply to a plot, change restrict_yaxis = True.
#nlevels_plot: 21 #Opt number of levels used in colorbar for contourf plot.
'NO2_CL_RYERSON':
nan_value: -777777 # Set this value to NaN
LLOD_value: -888888 # Opt Set this value to LLOD_setvalue
LLOD_setvalue: 0.0 # Opt Set LLOD_value=LLOD_setvalue, applied AFTER unit_scale and obs_unit
#ylabel_plot: 'NO2 (ppbv)' #Optional to set ylabel so can include units and/or instr etc.
#vmin_plot: 0.0 #Opt Min for y-axis during plotting. To apply to a plot, change restrict_yaxis = True.
#vmax_plot: 20.0 #Opt Max for y-axis during plotting. To apply to a plot, change restrict_yaxis = True.
#vdiff_plot: 15.0 #Opt +/- range to use in bias plots. To apply to a plot, change restrict_yaxis = True.
#nlevels_plot: 21 #Opt number of levels used in colorbar for contourf plot.
'Latitude_YANG':
rename: latitude # name to convert this variable to
unit_scale: 1 #Opt Scaling factor
unit_scale_method: '*' #Opt Multiply = '*' , Add = '+', subtract = '-', divide = '/'
'Longitude_YANG':
rename: longitude # name to convert this variable to
unit_scale: 1 #Opt Scaling factor
unit_scale_method: '*' #Opt Multiply = '*' , Add = '+', subtract = '-', divide = '/'
'P_BUI':
rename: pressure_obs # name to convert this variable to
unit_scale: 100 #Opt Scaling factor
unit_scale_method: '*' #Opt Multiply = '*' , Add = '+', subtract = '-', divide = '/'
'MSL_GPS_Altitude_YANG':
rename: altitude # name to convert this variable to
unit_scale: 1 #Opt Scaling factor
unit_scale_method: '*' #Opt Multiply = '*' , Add = '+', subtract = '-', divide = '/'

109 changes: 109 additions & 0 deletions examples/yaml/control_hrrr-smoke_mobile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# General Description:
# Any key that is specific for a plot type will begin with ts for timeseries, ty for taylor
# Opt: Specifying the variable or variable group is optional
# For now all plots except time series average over the analysis window.
# Seting axis values - If set_axis = True in data_proc section of each plot_grp the yaxis for the plot will be set based on the values specified in the obs section for each variable. If set_axis is set to False, then defaults will be used. 'vmin_plot' and 'vmax_plot' are needed for 'timeseries', 'spatial_overlay', and 'boxplot'. 'vdiff_plot' is needed for 'spatial_bias' plots and'ty_scale' is needed for 'taylor' plots. 'nlevels' or the number of levels used in the contour plot can also optionally be provided for spatial_overlay plot. If set_axis = True and the proper limits are not provided in the obs section, a warning will print, and the plot will be created using the default limits.
analysis:
start_time: '2022-09-11-06:00:00' #UTC
end_time: '2022-09-12-06:00:00' #UTC
output_dir: /wrk/charkins/melodies_monet/aircraft/develop_aircraft_mobile/Output_hrrr-smoke #Opt if not specified plots stored in code directory.
debug: True
model:
hrrr-smoke: # model label
files: /wrk/users/charkins/megan_mobile_data/HRRR/aqm_HRRR-Smoke_2022091106.nc.subset.nc
mod_type: random
mapping: #model species name : obs species name
mobile_fire:
PM2_5_DRY: 'PM2.5_5min'
'TMP_2maboveground': 'Temperature_5min'
plot_kwargs: #Opt
color: 'dodgerblue'
marker: '^'
linestyle: ':'
obs:
mobile_fire: # obs label
filename: '/wrk/users/charkins/megan_mobile_data/Fire_obs_all/treated_final_modtime.csv'
obs_type: mobile
resample: '600S'
time_var: 'time_5min'
variables: #Opt
'PM2.5_5min':
unit_scale: 1 #Opt Scaling factor
unit_scale_method: '*' #Opt Multiply = '*' , Add = '+', subtract = '-', divide = '/'

ylabel_plot: 'PM2.5 (units?)'
'Temperature_5min':
unit_scale: 273.15 #Opt Scaling factor
unit_scale_method: '+' #Opt Multiply = '*' , Add = '+', subtract = '-', divide = '/'
ylabel_plot: 'Temperature (K)' #Optional to set ylabel so can include units and/or instr etc.
'Latitude_5min':
rename: latitude # name to convert this variable to
unit_scale: 1 #Opt Scaling factor
unit_scale_method: '*' #Opt Multiply = '*' , Add = '+', subtract = '-', divide = '/'
'Longitude_5min':
rename: longitude # name to convert this variable to
unit_scale: 1 #Opt Scaling factor
unit_scale_method: '*' #Opt Multiply = '*' , Add = '+', subtract = '-', divide = '/'
plots:
plot_grp1:
type: 'timeseries' # plot type
fig_kwargs: #Opt to define figure options
figsize: [12,6] # figure size if multiple plots
default_plot_kwargs: # Opt to define defaults for all plots. Model kwargs overwrite these.
linewidth: 2.0
markersize: 10.
text_kwargs: #Opt
fontsize: 18.
domain_type: ['all'] #List of domain types: 'all' or any domain in obs file. (e.g., airnow: epa_region, state_name, siteid, etc.)
domain_name: ['CONUS'] #List of domain names. If domain_type = all domain_name is used in plot title.
data: ['mobile_fire_hrrr-smoke'] # make this a list of pairs in obs_model where the obs is the obs label and model is the model_label
data_proc:
rem_obs_nan: True # True: Remove all points where model or obs variable is NaN. False: Remove only points where model variable is NaN.
ts_select_time: 'time' #Time used for avg and plotting: Options: 'time' for UTC or 'time_local'
ts_avg_window: null # Options: None for no averaging or list pandas resample rule (e.g., 'H', 'D')
set_axis: False #If select True, add vmin_plot and vmax_plot for each variable in obs.
plot_grp2:
type: 'taylor' # plot type
fig_kwargs: #Opt to define figure options
figsize: [8,8] # figure size if multiple plots
default_plot_kwargs: # Opt to define defaults for all plots. Model kwargs overwrite these.
linewidth: 2.0
markersize: 10.
text_kwargs: #Opt
fontsize: 16.
domain_type: ['all'] #List of domain types: 'all' or any domain in obs file. (e.g., airnow: epa_region, state_name, siteid, etc.)
domain_name: ['CONUS'] #List of domain names. If domain_type = all domain_name is used in plot title.
data: ['mobile_fire_hrrr-smoke'] # make this a list of pairs in obs_model where the obs is the obs label and model is the model_label
data_proc:
rem_obs_nan: True # True: Remove all points where model or obs variable is NaN. False: Remove only points where model variable is NaN.
set_axis: True #If select True, add ty_scale for each variable in obs.
plot_grp3:
type: 'boxplot' # plot type
fig_kwargs: #Opt to define figure options
figsize: [8, 6] # figure size
text_kwargs: #Opt
fontsize: 20.
domain_type: ['all'] #List of domain types: 'all' or any domain in obs file. (e.g., airnow: epa_region, state_name, siteid, etc.)
domain_name: ['CONUS'] #List of domain names. If domain_type = all domain_name is used in plot title.
data: ['mobile_fire_hrrr-smoke'] # make this a list of pairs in obs_model where the obs is the obs label and model is the model_label
data_proc:
rem_obs_nan: True # True: Remove all points where model or obs variable is NaN. False: Remove only points where model variable is NaN.
set_axis: False #If select True, add vmin_plot and vmax_plot for each variable in obs.

stats:
#Stats require positive numbers, so if you want to calculate temperature use Kelvin!
#Wind direction has special calculations for AirNow if obs name is 'WD'
stat_list: ['MB', 'MdnB','R2', 'RMSE'] #List stats to calculate. Dictionary of definitions included in plots/proc_stats.py Only stats listed below are currently working.
#Full calc list ['STDO', 'STDP', 'MdnNB','MdnNE','NMdnGE', 'NO','NOP','NP','MO','MP', 'MdnO', 'MdnP', 'RM', 'RMdn', 'MB', 'MdnB', 'NMB', 'NMdnB', 'FB', 'ME','MdnE','NME', 'NMdnE', 'FE', 'R2', 'RMSE','d1','E1', 'IOA', 'AC']
round_output: 2 #Opt, defaults to rounding to 3rd decimal place.
output_table: False #Always outputs a .txt file. Optional to also output as a table.
output_table_kwargs: #Opt
figsize: [7, 3] # figure size
fontsize: 12.
xscale: 1.4
yscale: 1.4
edges: 'horizontal'
domain_type: ['all'] #List of domain types: 'all' or any domain in obs file. (e.g., airnow: epa_region, state_name, siteid, etc.)
domain_name: ['CONUS'] #List of domain names. If domain_type = all domain_name is used in plot title.
data: ['mobile_fire_hrrr-smoke'] # make this a list of pairs in obs_model where the obs is the obs label and model is the model_label

Loading
Loading