-
Notifications
You must be signed in to change notification settings - Fork 31
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
TROPOMI updates including pressure calculation #184
Conversation
pretty sure this is consistent with what Meng was doing
Thanks @blychs for the comments. |
this was part of Meng's update, as well as changing the key from YYYYMMDD to YYYY-MM-DD
Hi @zmoon , I was wondering on how exactly are you planning on adding PH and PHB to the _wrfchem_mm reader. I need equivalent variables for the _camx_mm reader, and was just calling them "layer_height_agl" and "topo_height" as part of solving Issue #189 , but would rather make the names consistent with whatever you make. I also need to choose on those names for the TEMPO MM utility. (That is a bit different from just adding PH and PHB, since PH and PHB include the topographic height as bottom_top_stagg=0) |
@blychs I was just following what Meng had done, which was just add them to the var list. So I was assuming that means they are included in the model output or can be automatically derived via wrf-python
The reader already has height AGL and above MSL. I don't think the height of the topography comes out though, at least by default. If @mlirenzhenmayi was only using PH, PHB to compute height as (PH+PHB)/g0, maybe we don't actually need them? And similar for P, PB. |
@zmoon I thought that was mid layer height, whereas PH and PHB are the geopotential at the layer interface. This is quite useful, because then (PH + PHB)[:, 1:, :, :] - (PH + PHB)[:, -1, :, :]) / g0 is the layer thickness, which is needed for calculating the partial column. If this is not the case, please let me know, because my _camx_mm reader assumes it is, and I would have to change that (that is, I calculated the height at mid layer for that variable). I don't think we need P, PB though. P + PB is just the pressure. |
@blychs I believe you are correct about the calculation. But if it's really the layer height thickness is needed, maybe we should have the reader return that instead, unless there is a chance of using the layer interface heights for something else. Also for WRF-Chem reader it looks like |
@zmoon I am not sure about the calculations. Do you think that having the layer height could be useful to interpolate to other (intermediate) altitudes? I'm thinking mostly about the aircraft team - I know close to nothing about aircraft field campaigns. If it isn't, then changing this to layer thickness wouldn't be to hard. |
@zmoon @blychs PH and PHB are used to calculate the height for each layer, and then we can calculate the partial column for each layer. Pressure for each layer = PB + P, from WRF-Chem. It's used for averaging kernels revision, based on which we established a function of Pressure and averaging kernel for each layer from TROPOMI, interpolate the model pressure to TROPOMI pressure for each layer, and then get the layered averaging kernel for the model. |
Hi @mlirenzhenmayi thanks for the comments. Is it correct that PB + P is the pressure of the layer interfaces? To use for conservative vertical interp based on pressure, for example. @rschwant and I think these calculations of interface height/pressure and layer height/pressure thickness might be better done inside the reader and assigned standardized variable names, like currently done for the mid-layer pressure/height. But that's outside the scope of this PR. |
PB+P is the mid-layer pressure. Maybe it's the tricky part of WRF-Chem. WRF-Chem doesn't provide the standard mid-layer pressure, so we need to calculate it based on the PB and P. If there's a standard calculation for mid-layer pressure covering different models, we can use that instead of calculating separately. |
@mlirenzhenmayi I was more thinking that we can move your calculation for these variables into the WRF-Chem reader, since they are model dependent. And then each model will do these calculations differently. And the analysis code will just use the standard value across all the models. Does that make sense? This can be a version 2 satellite advancement once we start standardizing the code more too. |
I think that makes sense. I do have a separate calculation module for this: https://github.com/NOAA-CSL/MELODIES-MONET/blob/develop/melodies_monet/util/cal_mod_no2col.py . It can be straight forward to combine cal_mod_no2col.py with the reader. |
@mlirenzhenmayi I think the partial column calculation can be outside the reader (or inside, open to others' thoughts about that). However, I do think it makes sense for the reader to provide the variables you need, instead of you needing to compute them from WRF-specific P,PB,PH,PHB,T.
Footnotes |
@zmoon The partial column calculation has already been calculated outside of the reader. It's done in cal_mod_no2col.py: https://github.com/NOAA-CSL/MELODIES-MONET/blob/develop/melodies_monet/util/cal_mod_no2col.py . I agree that the P, PB, PHB and PH should be read by default in the reader. |
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.
I tested the changes with my previous codes, and the results are right. I only have two comments for code revision.
for varname in ds.attrs["var_applied"]: | ||
logging.debug(f"applying quality flag to {varname}") | ||
values = ds[varname].values | ||
values[quality_flag <= quality_thresh_min] = np.nan | ||
|
||
|
||
def open_dataset(fnames, variable_dict, debug=False): |
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.
can we change the function name to read_trpdataset? Just to be consistent with driver which has been incorporated into melodies-monet
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.
I added it as an alias: 626b95c
In general, we're trying to keep API's for the different model/sat readers somewhat consistent, with the same function names etc.
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.
Add one comment on pressure dimension
Meng's original func name
Based on NCAR@98405e9
cc: @dwfncar @mlirenzhenmayi @rrbuchholz