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

adding a reader for ATMS level1b data #2187

Merged
merged 10 commits into from
Nov 9, 2022
Merged

Conversation

BengtRydberg
Copy link
Contributor

@BengtRydberg BengtRydberg commented Aug 19, 2022

This PR adds a reader for the Advanced Technology Microwave Sounder (ATMS) Level 1B data.
The reason for this is that the nowcasting SAF intends to include a pipeline for processing ATMS within the PPS microwave package where satpy is used for reading of level1b data, and it seems that no existing reader for ATMS data is available within satpy.

  • Closes #xxxx
  • Tests added
  • Fully documented
  • Add your name to AUTHORS.md if not there already

@codecov
Copy link

codecov bot commented Aug 19, 2022

Codecov Report

Merging #2187 (093f622) into main (15be5c1) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #2187      +/-   ##
==========================================
+ Coverage   94.14%   94.16%   +0.01%     
==========================================
  Files         294      296       +2     
  Lines       45183    45310     +127     
==========================================
+ Hits        42539    42666     +127     
  Misses       2644     2644              
Flag Coverage Δ
behaviourtests 4.65% <0.00%> (-0.02%) ⬇️
unittests 94.81% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
satpy/readers/atms_l1b_nc.py 100.00% <100.00%> (ø)
satpy/tests/reader_tests/test_atms_l1b_nc.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@coveralls
Copy link

coveralls commented Aug 19, 2022

Coverage Status

Coverage increased (+0.01%) to 94.762% when pulling 093f622 on BengtRydberg:atms_reader into 15be5c1 on pytroll:main.

Copy link
Member

@djhoese djhoese left a comment

Choose a reason for hiding this comment

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

From a quick scan of this, this looks really well done. Thanks for adding it and making the pull request. I've made a few comments and suggestions. Let me know what you think. What still needs to be done for this to be not a draft?

Comment on lines 143 to 149
try:
dataset = (
self[param] if param not in self.channel_name_to_index
else self._get_channel_data(param)
)
except KeyError:
logger.warning(f'Could not find {param} in NetCDF file, no valid Dataset created') # noqa: E501
Copy link
Member

Choose a reason for hiding this comment

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

Is this try/except needed? Is the error message that is generated by default (without this try/except) too confusing? I'm not sure this adds much to the log. Additionally, I'm not sure returning None is the expected behavior when a dataset can't be loaded. I think KeyError should be handled just fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I checked and found out this try/except is not needed. The default error message is good enough, so I removed it.

Comment on lines 35 to 58
ATMS_CHANNEL_NAME_TO_INDEX = {
"1": 0,
"2": 1,
"3": 2,
"4": 3,
"5": 4,
"6": 5,
"7": 6,
"8": 7,
"9": 8,
"10": 9,
"11": 10,
"12": 11,
"13": 12,
"14": 13,
"15": 14,
"16": 15,
"17": 16,
"18": 17,
"19": 18,
"20": 19,
"21": 20,
"22": 21,
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure I understand why this is needed. Isn't this just int(channel_name) - 1? It might be cleaner and less code overall if in the data loading you did something like:

try:
    channel_index = int(name) - 1
    return self.antenna _temperature[:, :, channel_index]
except TypeError:
    return self[name]

then you don't have to have this dictionary or the overridden __init__.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, your suggestion is much cleaner. Fixed it.

Reader for JPSS Advanced Technology Microwave Sounder Level 1B files in NetCDF4.
status: Beta
sensors: [atms]
reader: !!python/name:satpy.readers.yaml_reader.FileYAMLReader
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
reader: !!python/name:satpy.readers.yaml_reader.FileYAMLReader
reader: !!python/name:satpy.readers.yaml_reader.FileYAMLReader
supports_fsspec: false

This additional information was added recently and is described here: https://satpy.readthedocs.io/en/latest/dev_guide/custom_reader.html#the-reader-section

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for letting me know.

@BengtRydberg
Copy link
Contributor Author

From a quick scan of this, this looks really well done. Thanks for adding it and making the pull request. I've made a few comments and suggestions. Let me know what you think. What still needs to be done for this to be not a draft?

One reason this is a draft PR is that I wanted to include a data_identification_key (frequency_quadruple_sideband) in the yaml file that is currently being developed in #2120

@djhoese
Copy link
Member

djhoese commented Aug 21, 2022

One reason this is a draft PR is that I wanted to include a data_identification_key (frequency_quadruple_sideband) in the yaml file that is currently being developed in #2120

Sounds good. Thanks for letting me know. I'm not sure I'm the right person to review something like that and it looks like Gerrit already got to it. Let me know if you need anything else from me until this PR is further along.

@adybbroe
Copy link
Contributor

Oh, this is great @BengtRydberg I had adding ATMS reader on my to-do-list! :-)
I will have a look at this shortly, and I am now trying to close the PR you refer to above!

@BengtRydberg BengtRydberg marked this pull request as ready for review September 16, 2022 16:42
Copy link
Member

@mraspaud mraspaud left a comment

Choose a reason for hiding this comment

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

LGTM. Clean work, just two small comments inline. Regarding the failing test: it's being worked on, so we're waiting for it to be fixed before merging other PRs.

@BengtRydberg
Copy link
Contributor Author

LGTM. Clean work, just two small comments inline. Regarding the failing test: it's being worked on, so we're waiting for it to be fixed before merging other PRs.

ok.

@mraspaud
Copy link
Member

@BengtRydberg the tests are fixed in main now, could you merge main into your branch?

@BengtRydberg
Copy link
Contributor Author

@BengtRydberg the tests are fixed in main now, could you merge main into your branch?

I have merged main into the branch, but note that I had to add an rtol in assert_allclose test that is not mine, in order to not fail unit tests in CI. This test seems to test details from another package (skyfield). Maybe I should not have done this?

@mraspaud
Copy link
Member

mraspaud commented Nov 9, 2022

@BengtRydberg the tests are fixed in main now, could you merge main into your branch?

I have merged main into the branch, but note that I had to add an rtol in assert_allclose test that is not mine, in order to not fail unit tests in CI. This test seems to test details from another package (skyfield). Maybe I should not have done this?

that's fine.

@mraspaud mraspaud added enhancement code enhancements, features, improvements component:readers labels Nov 9, 2022
Copy link
Member

@mraspaud mraspaud left a comment

Choose a reason for hiding this comment

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

LGTM

@mraspaud mraspaud merged commit 5848064 into pytroll:main Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:readers enhancement code enhancements, features, improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants