-
Notifications
You must be signed in to change notification settings - Fork 100
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
Flow-Dependent, Cross-Timescale Model Diagnostic POD #127
Open
drewmresnick
wants to merge
120
commits into
NOAA-GFDL:main
Choose a base branch
from
drewmresnick:feature/flow_dep_diags
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 117 commits
Commits
Show all changes
120 commits
Select commit
Hold shift + click to select a range
cfe7d4f
Merge pull request #1 from NOAA-GFDL/develop
0e67cc2
creating a dummy PR for the 'flow-dependent, cross-timescale model di…
4110808
renaming files; adding settings file; deleted old directory
61d7f8b
adding to the settings.jsonc file
7dede33
added python files for diagnostics
ff796c9
adding variables to settings document
488c6ac
changing diagnostics code to start incorporating envt vars; change fi…
6d1ea26
adding a mostly blank file which will be used as main driver file
44a6b97
editing files to include environment variables
64582dc
add in info for envt vars
d0d2ac2
create new file with working code without env vars
5736bf4
add function file to calc climatology anomalies
38faa87
initial redo of settings file
0c4ce2b
adding environment variables into main code
4122050
editing environment variables
2d2ae39
editing environment vars in driver file
3a071c1
edit variable names to fit convention of example data
a5ede68
editing environment variables
b00df52
edit settings file to slice vars at pressure level
d9f8103
edit settings file
b85db3c
add .DS_Store to gitignore
30ce656
Adding variables to fieldlist_NCAR.jsonc
8c3a03b
add units to varlist; change varlist key structure
9595c20
making some changes to environment variables to get POD working on mo…
b11e928
removing progress checks from code
5edb993
new progress checks added
16390e1
make a function which runs the diagnostic on model data
ed31845
changing output file name
1cc7cac
editing driver script to check for missing files.
86e8079
adding documentation, removing excess code
42fb697
Saving climatology anomaly data as new files
bd736c0
adding in documentation
521b525
add yaml file
b80a836
add documentation to main file
28d0594
adding documentation to file used for preprocessing of data
065575c
adding documentation
311c0c8
adding documentation
dc94dc7
edit casename for sample data
8e0bbfd
Merge pull request #2 from NOAA-GFDL/develop
94c2f99
Merge branch 'develop' into feature/flow_dep_diags
56d8e7e
uncommenting out variables
624530b
removing merge conflict notation
04ab32a
removing un-needed comment
dc063d3
set paths to none for example cropping code
446961d
removing template lines
2bff623
removing comment
0f54445
removing prefix condition from yaml
88e7de2
delete old file
1c1cf72
deleting unneccessary comment
1beb836
delete pandas import from code
d667a6a
aditional pandas import deleted
0e0fa69
delete unused function
183a3bc
minor edits
b02c0f5
remove modification from src file
d117663
editing long names to fix fieldlist conflict; adding alternative for …
8c957df
removing edits from default settings file
2bb30d8
edit alternate variable in settings file
5a8674c
creating a dummy PR for the 'flow-dependent, cross-timescale model di…
dc54488
renaming files; adding settings file; deleted old directory
d60c275
adding to the settings.jsonc file
b3d9024
added python files for diagnostics
10625b6
adding variables to settings document
dac629b
changing diagnostics code to start incorporating envt vars; change fi…
a616df9
adding a mostly blank file which will be used as main driver file
683f1ba
editing files to include environment variables
e12df0a
add in info for envt vars
11ecd5e
create new file with working code without env vars
7ce9b5c
add function file to calc climatology anomalies
b8440df
initial redo of settings file
99d3d8b
adding environment variables into main code
9a50ec6
editing environment variables
e473b59
editing environment vars in driver file
442b4dc
edit variable names to fit convention of example data
7c1a43d
editing environment variables
360b6f7
edit settings file to slice vars at pressure level
acfb4fb
edit settings file
902e731
add .DS_Store to gitignore
0d9259a
Adding variables to fieldlist_NCAR.jsonc
ad88d93
add units to varlist; change varlist key structure
9cef3c3
making some changes to environment variables to get POD working on mo…
bda078b
removing progress checks from code
3aa47aa
new progress checks added
de49316
make a function which runs the diagnostic on model data
55728dd
changing output file name
7125ec7
editing driver script to check for missing files.
df4ed16
adding documentation, removing excess code
825afd5
Saving climatology anomaly data as new files
63bc1b0
adding in documentation
9190b98
add yaml file
2ec611c
add documentation to main file
15bd2e3
adding documentation to file used for preprocessing of data
2768fea
adding documentation
385a2f1
adding documentation
85ad6cb
edit casename for sample data
a73aa69
uncommenting out variables
b9c9f7f
removing merge conflict notation
5874d29
removing un-needed comment
febdf6d
set paths to none for example cropping code
cc1a950
removing template lines
09a4e98
removing comment
e903dec
removing prefix condition from yaml
72a26a6
delete old file
9ba4694
deleting unneccessary comment
45ffc12
delete pandas import from code
1c7010c
aditional pandas import deleted
3e52efa
delete unused function
b4f9766
minor edits
824007e
remove modification from src file
28c6019
editing long names to fix fieldlist conflict; adding alternative for …
3564967
removing edits from default settings file
4c9df31
edit alternate variable in settings file
0d27e5f
editing variable standard names in settings file
f313f8a
editing variable standard names in fieldlist file
89b8d69
Merge branch 'feature/flow_dep_diags' of github.com:drewmresnick/MDTF…
f5d54e3
minor corrections to documentation
8454226
reverting default_tests.jsonc back to its original state
03616ec
removing unused varibales / module
e342906
change decode_times to use_cftime
cfb2a4e
edit comments for explaining how grid shift works
ac57a47
Merge branch 'NOAA-GFDL:main' into feature/flow_dep_diags
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,4 +94,5 @@ pip-log.txt | |
pip-delete-this-directory.txt | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
.ipynb_checkpoints | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import os | ||
import xarray as xr | ||
import numpy as np | ||
from datetime import datetime | ||
np.seterr(divide='ignore', invalid='ignore') | ||
|
||
### Function to calculate climatology anomalies for each variable in the diagnostic. | ||
|
||
time_var = os.environ["time_coord"] #set environment variable for time equal to var for function | ||
#function to calculate climatology anomalies for eah variable | ||
def climAnom(var_path, var_name): | ||
|
||
ds = xr.open_dataset(var_path, decode_times = True) | ||
wrongkindofdoctor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
ds[time_var] = ds.indexes[time_var].to_datetimeindex() #convert time to datetime so we can use groupby functionality | ||
# Drop 1 dimensional coordinates | ||
ds = ds.squeeze() | ||
da = ds[var_name] | ||
da_ensmean = da.copy() | ||
da_day_clim = da_ensmean.groupby('{time_coord}.dayofyear'.format(**os.environ)).mean(time_var) | ||
da_day_anom = da.groupby('{time_coord}.dayofyear'.format(**os.environ)) - da_day_clim | ||
da_day_anom = da_day_anom.drop('dayofyear') | ||
da_day_anom.to_netcdf("{WK_DIR}/model/netCDF/".format(**os.environ) + var_name + "_climAnom.nc") | ||
return da_day_anom |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add in the companion fields to the GFDL and CMIP fieldlists
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jkrasting Is this then not something I need to worry about?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@drewmresnick This is a todo for the framework team, so one of us will take care of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for bringing this to my attention. Unfortunately constructions of the from
variable_at_XX_mbar
aren't CF standard names [*].The way variables on pressure levels are intended to be specified in the settings file is described in the documentation: the level is specified separately with a
scalar_coordinate
attribute, which refers to a vertical coordinate axis defined in the dimensions section of the file. By spelling out what's meant in more detail like this, it e.g. enables the framework to extract levels from 3D data on the fly in a fully units-aware way.For more examples of how this is set up, look at the settings file for the Wheeler-Kiladis diagnostic.
[*]: I haven't been able to find a concise reference for this: the upshot is that standard names are meant to identify physical quantities, independently of how that quantity is sampled in space or time (but there are exceptions to this, such as
air_pressure_at_sea_level
, which deal with physical rather than mathematical boundaries). Variables on pressure levels in the CMIP6 data request don't use different standard names in this way (example), and pressure levels aren't one of the cases covered in construction of derived standard names.