-
Notifications
You must be signed in to change notification settings - Fork 2
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
Plotting script radiosounding #21
Conversation
The folder contains the python code for the plots and a Readme file.
The code has been updated to fulfill the be in accordance with PEP 8 which is checked with black and flake8.
The input file name had to be in a very specific form. Now, it can be more flexible but it should include the direction (ascent or descent). Otherwise, no SkewT plot will be created. Furthermore, this commit contains an update of the Readme.
The folder contains the python code for the plots and a Readme file.
The code has been updated to fulfill the be in accordance with PEP 8 which is checked with black and flake8.
The input file name had to be in a very specific form. Now, it can be more flexible but it should include the direction (ascent or descent). Otherwise, no SkewT plot will be created. Furthermore, this commit contains an update of the Readme.
6086f46
to
01123a1
Compare
# Define input file | ||
filename = args["inputfile"] | ||
|
||
data = xr.open_dataset(filename) |
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.
data = xr.open_dataset(filename) | |
data = xr.open_dataset(filename) | |
data = data.pint.quantify() |
This reads in the units given in the metadata of the dataset and makes the variables unit aware.
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.
Maybe you need to use
data = data.pint.quantify(unit_registry=units)
to have the same unit registry as metpy otherwise it might get you some errors.
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.
Hi @LauraKoehler,
This looks already very good! The previous errors were indeed caused by scripts that you haven't touched. Now the CI runs successfully but I have a few additional suggestions to make your addition even more useful by using unit-aware functions so that the input dataset does not need to have specific units and the windspeed could for example be given in m/s instead of knots. I made some suggestions but didn't do it for all variables. Could you try to implement my suggestion and make it work for all variables? That would be very neat and I promise to accept the PR afterwards 💯
# Define input file | ||
filename = args["inputfile"] | ||
|
||
data = xr.open_dataset(filename) |
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.
Maybe you need to use
data = data.pint.quantify(unit_registry=units)
to have the same unit registry as metpy otherwise it might get you some errors.
@LauraKoehler did my comments make sense? :) |
The script now uses unit-aware function for all plots to avoid that variables have to be given in specific units in the input data.
I used an older metpy version which produces a white space left of the skewT diagram due to the rotation of the T axis. This problem is solved with a newer metpy version but I had to make a few changes in the way the numbers like CAPE and CIN are rounded for the inset to use the round function only on a float which didn't matter before.
@observingClouds, the comments make sense indeed and I updated the script accordingly such that the units are taken into account now and variables don't have to have specific units anymore. In this context, I had to do a few additional changes since I use another version of metpy now. I hope, it's more version independent now. ;-) |
8828e75
to
9b788cb
Compare
1f3671f
to
154806d
Compare
Hi @LauraKoehler, see artifacts at https://github.com/observingClouds/pysonde/actions/runs/6461156965 |
154806d
to
95495a4
Compare
95495a4
to
8091c68
Compare
The folder scripts contains a script to plot the data from one sounding. It creates 5 plots: 1. the trajectory of the sonde, 2. wind speed and direct for ascent and descent, 3. temperature, dew point temperature, relative humidity, and mixing ratio for ascent and descent, 4. skewT plot for ascent, 5. skewT plot for descent.