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

TEMPO NO2 reader #188

Merged
merged 25 commits into from
Sep 9, 2024
Merged

Conversation

blychs
Copy link
Contributor

@blychs blychs commented Aug 23, 2024

This is a tempo reader based on the TROPOMI NO2 reader, set up for compatibility with MELODIES-MONET. It has been tested with locally downloaded data, using MONET plotting capabilities. Pairing (at the MONET or MELODIES-MONET levels) has not been programmed in yet. A test case for this, with automatic downloads, would require an earthdata user --which would also require an additional dependency (namely, earthdata). If that is acceptable, I could set it up.
Pablo

@zmoon
Copy link
Member

zmoon commented Aug 24, 2024

@blychs , alternatively, if you have an example file, we could place it here: https://csl.noaa.gov/groups/csl4/modeldata/melodies-monet/data/example_observation_data/satellite/

monetio/sat/_tempo_l2_no2_mm.py Outdated Show resolved Hide resolved
monetio/sat/_tempo_l2_no2_mm.py Outdated Show resolved Hide resolved
monetio/sat/_tempo_l2_no2_mm.py Outdated Show resolved Hide resolved
monetio/sat/_tempo_l2_no2_mm.py Outdated Show resolved Hide resolved
monetio/sat/_tempo_l2_no2_mm.py Outdated Show resolved Hide resolved
@blychs
Copy link
Contributor Author

blychs commented Aug 25, 2024

@blychs , alternatively, if you have an example file, we could place it here: https://csl.noaa.gov/groups/csl4/modeldata/melodies-monet/data/example_observation_data/satellite/

I do have files for this. Let me know how to give them to you so that they can be uploaded (I would just need to get rid of unnecessary variables so that we can have a full scan).

@zmoon
Copy link
Member

zmoon commented Aug 27, 2024

I do have files for this. Let me know how to give them to you so that they can be uploaded (I would just need to get rid of unnecessary variables so that we can have a full scan).

Sounds good. I'll send an email.

@blychs
Copy link
Contributor Author

blychs commented Aug 27, 2024

I found a bug in my code, which is with the application of the quality flags, maximum and minimum. i. e., I'm asking it to compare the values with the max, min or (for the quality_flag) qa_treshold. However, this breaks if the value is NaN, due to the way the comparison is made. It should be an easy fix, which I'll hopefully update today.

	Previous version failed when nan was compared with flags/max/min
	Added options for more variables, including pressure calculation
@blychs
Copy link
Contributor Author

blychs commented Aug 28, 2024

Those bugs should be fixed now. I also added options for the rest of the possible variables a user might want, including everything needed to apply air mass factors and scattering weights and a pressure calculations. This means that the changes are quite large, and might require careful checking. I tried my code with all variables and it seems to be working fine, and the pre-commit hooks are passing. I don't really know how to run the linter though, should I just install pylint and give it a go?

@zmoon
Copy link
Member

zmoon commented Aug 28, 2024

the pre-commit hooks are passing. I don't really know how to run the linter though

Linting is included in the pre-commit hooks. But if you do want to run it (flake8) individually sometime:

pre-commit run flake8 --all-files

or

pre-commit run flake8 --file some/path.py

blychs added 10 commits August 28, 2024 14:34
	Preserve the correct behaviour of the "minimum" and "maximum"
	flags when comparing arrays to those values, while making
	sure it still works with int type arrays (np.NaN can't be
	casted to hace a[a < min] = np.nan if dtype(a) = np.array(int).

	Decode time.
	Previous behaviour was switching values into NaN.
	New behaviour is consistent with data types.
	Make sure that the code does not force the user to have the
	3D pressure if they did not ask for it.
tests/test_tempo_l2.py Outdated Show resolved Hide resolved
tests/test_tempo_l2.py Outdated Show resolved Hide resolved
blychs and others added 3 commits August 30, 2024 15:29
	Change np.masked_where to np.masked_less and np.masked_greater.
	Change the order of the dimensions of pressure.
monetio/sat/__init__.py Outdated Show resolved Hide resolved
blychs and others added 3 commits August 30, 2024 16:00
If set "units" are needed in the future, change ds["time"].encoding

Co-authored-by: Zachary Moon <[email protected]>
monetio/sat/_tempo_l2_no2_mm.py Show resolved Hide resolved
monetio/sat/_tempo_l2_no2_mm.py Outdated Show resolved Hide resolved
@zmoon zmoon mentioned this pull request Sep 5, 2024
Copy link
Member

@zmoon zmoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @blychs for your work on this and helping with #184 as well.

@zmoon zmoon merged commit 2d4dc68 into noaa-oar-arl:develop Sep 9, 2024
7 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.

2 participants