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

revise tropomi modules for monetio updates #282

Merged
merged 5 commits into from
Oct 7, 2024

Conversation

mlirenzhenmayi
Copy link
Collaborator

update drivers, tropomi no2 - wrfchem paring

melodies_monet/driver.py Outdated Show resolved Hide resolved
as reviewed and suggested by Zach
replace calculation of model layer thickness, to use dzh directly
@mbruckner-work
Copy link
Collaborator

From what I can tell, the changes are fine for ensuring the TROPOMI NO2 capability works before the tutorial.

I would suggest adding a scaling to the paired observations and model data like was done for MOPITT CO (eg. linked codeblock). An argument to specify ylabel_plot (ylabel_plot: '$10^{18} molec/cm^{2}$' ) then should go in the yaml file with the variable name under the obs label (see control_mopitt.yaml). The axes on the Taylor plot will actually be readable this way.

# Apply scaling to drop scientific notation (x10^{18} molec/cm2 instead of molec/cm2)
## Taylor plot doesn't work if don't do this.
ds[co_ppbv_varname+'_column_model'] /= 1e18
ds[co_ppbv_varname+"_column_model"] = ds[co_ppbv_varname+'_column_model'].assign_attrs(units='$10^{18} molec./cm^{2}$')
ds['column'] /= 1e18
ds["column"] = ds['column'].assign_attrs(units='$10^{18} molec./cm^{2}$')

@blychs
Copy link
Collaborator

blychs commented Oct 5, 2024

@mlirenzhenmayi , I would still go for keys(). This is already the solution in #284 , and .variables fails if it is DataFrame.
Otherwise, we would have to add checks to see whether it is a dataframe or a dataset.

@zmoon
Copy link
Collaborator

zmoon commented Oct 5, 2024

@blychs for membership it's the same without .keys() (if var in df_or_ds:). Will it not always be an xarray dataset for satellite?

@blychs
Copy link
Collaborator

blychs commented Oct 5, 2024

If var in ds_or_df would work and is probably the best solution, I agree. Satellite is always ds, but that check is run for every case, including surface and aircraft, if I'm not wrong

melodies_monet/driver.py Outdated Show resolved Hide resolved
change if 'altitude' in pairdf

Co-authored-by: Zachary Moon <[email protected]>
@mlirenzhenmayi
Copy link
Collaborator Author

From what I can tell, the changes are fine for ensuring the TROPOMI NO2 capability works before the tutorial.

I would suggest adding a scaling to the paired observations and model data like was done for MOPITT CO (eg. linked codeblock). An argument to specify ylabel_plot (ylabel_plot: '$10^{18} molec/cm^{2}$' ) then should go in the yaml file with the variable name under the obs label (see control_mopitt.yaml). The axes on the Taylor plot will actually be readable this way.

# Apply scaling to drop scientific notation (x10^{18} molec/cm2 instead of molec/cm2)
## Taylor plot doesn't work if don't do this.
ds[co_ppbv_varname+'_column_model'] /= 1e18
ds[co_ppbv_varname+"_column_model"] = ds[co_ppbv_varname+'_column_model'].assign_attrs(units='$10^{18} molec./cm^{2}$')
ds['column'] /= 1e18
ds["column"] = ds['column'].assign_attrs(units='$10^{18} molec./cm^{2}$')

Thanks Maggie! Current tropomi modules can plot Taylor, although with messed units. But with the scaling applied, other plots like the map plot, box plot are messed up and need to be re-configured with units in the yaml file. I prefer to revise the Taylor plot module to make it more flexible to handle large units.

@blychs
Copy link
Collaborator

blychs commented Oct 7, 2024

From what I can tell, the changes are fine for ensuring the TROPOMI NO2 capability works before the tutorial.
I would suggest adding a scaling to the paired observations and model data like was done for MOPITT CO (eg. linked codeblock). An argument to specify ylabel_plot (ylabel_plot: '$10^{18} molec/cm^{2}$' ) then should go in the yaml file with the variable name under the obs label (see control_mopitt.yaml). The axes on the Taylor plot will actually be readable this way.

# Apply scaling to drop scientific notation (x10^{18} molec/cm2 instead of molec/cm2)
## Taylor plot doesn't work if don't do this.
ds[co_ppbv_varname+'_column_model'] /= 1e18
ds[co_ppbv_varname+"_column_model"] = ds[co_ppbv_varname+'_column_model'].assign_attrs(units='$10^{18} molec./cm^{2}$')
ds['column'] /= 1e18
ds["column"] = ds['column'].assign_attrs(units='$10^{18} molec./cm^{2}$')

Thanks Maggie! Current tropomi modules can plot Taylor, although with messed units. But with the scaling applied, other plots like the map plot, box plot are messed up and need to be re-configured with units in the yaml file. I prefer to revise the Taylor plot module to make it more flexible to handle large units.

Hi Meng and Maggie, I tried to do that in the plotting class and was not able to (for the TEMPO tool). I think that the problem is with the AxisArtist class from Matplotlib that the MONET uses, but I was not able to find an easy solution for that.
In satplots_xr, I just added the option "normalize", which plots a normalized Taylor diagram... therefore having smaller numbers.
I agree that revising the Taylor plot module is a better solution, and maybe someone else can find a way to do it (maybe there is a way with the GridHelperCurveLine?).

Having the option for an offset as suggested by Maggie is a better solution than mine, we could add that to the plt_grp in the yaml (and not the observations) for Taylor (even better, we could have both an offset and the option for normalizing it). However, I'd say that we can merge TROPOMI for now and deal with that after the deadline.
Would that work?
Cheers
Pablo

@mbruckner-work
Copy link
Collaborator

Thanks Maggie! Current tropomi modules can plot Taylor, although with messed units. But with the scaling applied, other plots like the map plot, box plot are messed up and need to be re-configured with units in the yaml file. I prefer to revise the Taylor plot module to make it more flexible to handle large units.

I hadn't noticed an issue with maps, but generally am not using the box plot tool and haven't been checking it in my tests. I agree with @blychs that we can deal with solutions for this later.

@mlirenzhenmayi
Copy link
Collaborator Author

From what I can tell, the changes are fine for ensuring the TROPOMI NO2 capability works before the tutorial.
I would suggest adding a scaling to the paired observations and model data like was done for MOPITT CO (eg. linked codeblock). An argument to specify ylabel_plot (ylabel_plot: '$10^{18} molec/cm^{2}$' ) then should go in the yaml file with the variable name under the obs label (see control_mopitt.yaml). The axes on the Taylor plot will actually be readable this way.

# Apply scaling to drop scientific notation (x10^{18} molec/cm2 instead of molec/cm2)
## Taylor plot doesn't work if don't do this.
ds[co_ppbv_varname+'_column_model'] /= 1e18
ds[co_ppbv_varname+"_column_model"] = ds[co_ppbv_varname+'_column_model'].assign_attrs(units='$10^{18} molec./cm^{2}$')
ds['column'] /= 1e18
ds["column"] = ds['column'].assign_attrs(units='$10^{18} molec./cm^{2}$')

Thanks Maggie! Current tropomi modules can plot Taylor, although with messed units. But with the scaling applied, other plots like the map plot, box plot are messed up and need to be re-configured with units in the yaml file. I prefer to revise the Taylor plot module to make it more flexible to handle large units.

Hi Meng and Maggie, I tried to do that in the plotting class and was not able to (for the TEMPO tool). I think that the problem is with the AxisArtist class from Matplotlib that the MONET uses, but I was not able to find an easy solution for that. In satplots_xr, I just added the option "normalize", which plots a normalized Taylor diagram... therefore having smaller numbers. I agree that revising the Taylor plot module is a better solution, and maybe someone else can find a way to do it (maybe there is a way with the GridHelperCurveLine?).

Having the option for an offset as suggested by Maggie is a better solution than mine, we could add that to the plt_grp in the yaml (and not the observations) for Taylor (even better, we could have both an offset and the option for normalizing it). However, I'd say that we can merge TROPOMI for now and deal with that after the deadline. Would that work? Cheers Pablo

Sounds good to me. - Meng

@rschwant
Copy link
Collaborator

rschwant commented Oct 7, 2024

Is this ready now? Should we merge it in?

@blychs
Copy link
Collaborator

blychs commented Oct 7, 2024

@mbruckner-work , I believe we still need you to approve the review?

@rschwant rschwant merged commit f18f3ab into NOAA-CSL:develop Oct 7, 2024
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants