Add emission and deposition tables to the budget - #457
Conversation
…ons and depositions- for all variables, add a calculation option using annual mean files
justin-richling
left a comment
There was a problem hiding this comment.
This PR is mostly good @Behrooz-Roozitalab, thank you for breaking this up logically! It looks like a lot of suggested changes, but it's really only related to commented out code and some indentation suggestions. I will merge this when you get to these, thanks again!
| @@ -136,7 +153,7 @@ def aerosol_gas_tables(adfobj, trop_val=None, **kwargs): | |||
| # if True, calculate only Tropospheric values | |||
| # if False, all layers | |||
| # tropopause is defiend as either directly or indirectly. Look for tropopause to see the definition | |||
| Tropospheric = bres['Tropospheric'] | |||
| #Tropospheric = bres['Tropospheric'] | |||
There was a problem hiding this comment.
Sorry for the late review on this @Behrooz-Roozitalab! The only question I have is if this is commented out, could we just remove it, or is this something that might get flagged later?
| raise AdfError(errmsg) | ||
|
|
||
| # Initialize nicknames dictionary | ||
| #nicknames = {} |
There was a problem hiding this comment.
Can we remove this if it is not being used?
| # Calculated duration of time period in seconds? | ||
| #durations[case] = (end_period-start_period).days*86400 #+365*86400 | ||
|
|
||
|
|
||
| # Get number of years for calculations | ||
| #num_yrs[case] = (int(end_year)-int(start_year)) #+1 |
There was a problem hiding this comment.
Can we also remove these commented out lines?
| except subprocess.CalledProcessError as e: | ||
| print(f"NCO Error (Exit Code {e.returncode}): {e.stderr}") | ||
|
|
||
| #os.sys(f"ncra {Files} {output_location}/{case}_ANN.nc") |
There was a problem hiding this comment.
Is this also safe to remove?
|
|
||
| # Gather dictionary data for current case | ||
| # NOTE: The calculations can take a long time... | ||
| #Dic_scn_var_comp[case] = make_Dic_scn_var_comp_2D(adfobj, VARIABLES, data_dir, dic_SE, Files, ext1_SE, AEROSOLS) |
There was a problem hiding this comment.
Can we also remove this and line 273, #inside = Inside_SE_region(current_lat,current_lon,dir_shapefile)?
| needed_vars = [] | ||
| Dic_all_data={} | ||
|
|
||
| # all_data=[] |
There was a problem hiding this comment.
Can we remove this line?
| if file == 0: | ||
| Dic_all_data[var]=[] | ||
|
|
||
| # Star gathering of variable data |
There was a problem hiding this comment.
Let's indent this to match the formatting and fix typo to # Start gathering ...
| data=data*delP | ||
| else: | ||
| data=data | ||
| # End if |
There was a problem hiding this comment.
Looks like this is also off on the formatting, could you indent/move it to the correct spot?
| nickname = case | ||
|
|
||
| # Collect row data in a list of dictionaries | ||
| #durations[case] |
There was a problem hiding this comment.
Remove this commented out line.
| @@ -136,7 +153,7 @@ def aerosol_gas_tables(adfobj, trop_val=None, **kwargs): | |||
| # if True, calculate only Tropospheric values | |||
| # if False, all layers | |||
| # tropopause is defiend as either directly or indirectly. Look for tropopause to see the definition | |||
| Tropospheric = bres['Tropospheric'] | |||
| #Tropospheric = bres['Tropospheric'] | |||
|
|
|||
| ### NOT WORKING FOR NOW | |||
There was a problem hiding this comment.
Is this still not currently working, or can we remove this line too?
Updates to the budget code including:
Also, two tables are added to this version (could be called in YAML file) to calculate the emissions and depositions for all the variables in the files.