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

Add reader for AMSR2 Level 2 data produced by GAASP software (amsr2_l2_gaasp) #1421

Merged
merged 23 commits into from Dec 16, 2020

Conversation

djhoese
Copy link
Member

@djhoese djhoese commented Oct 31, 2020

The CSPP team at SSEC recently released a version of the GAASP processing software which produces level 2 products for the AMSR2 instrument. This PR adds a reader to read those GAASP produced files.

  • Tests added
  • Passes flake8 satpy
  • Fully documented

@djhoese djhoese added enhancement code enhancements, features, improvements component:readers labels Oct 31, 2020
@djhoese djhoese self-assigned this Oct 31, 2020
@ghost
Copy link

ghost commented Oct 31, 2020

DeepCode's analysis on #8ea80f found:

  • ℹ️ 1 minor issue. 👇

Top issues

Description Example fixes
Value 'self.nc' is unsubscriptable Occurrences: 🔧 Example fixes

👉 View analysis in DeepCode’s Dashboard | Configure the bot

@codecov
Copy link

codecov bot commented Oct 31, 2020

Codecov Report

Merging #1421 (8ea80f3) into master (c0e21e6) will increase coverage by 0.04%.
The diff coverage is 96.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1421      +/-   ##
==========================================
+ Coverage   90.58%   90.62%   +0.04%     
==========================================
  Files         239      241       +2     
  Lines       34313    34586     +273     
==========================================
+ Hits        31081    31344     +263     
- Misses       3232     3242      +10     
Flag Coverage Δ
behaviourtests 4.50% <0.00%> (-0.04%) ⬇️
unittests 91.10% <96.33%> (+0.04%) ⬆️

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

Impacted Files Coverage Δ
satpy/readers/amsr2_l2_gaasp.py 93.46% <93.46%> (ø)
satpy/tests/reader_tests/test_amsr2_l2_gaasp.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c0e21e6...8ea80f3. Read the comment docs.

@coveralls
Copy link

coveralls commented Oct 31, 2020

Coverage Status

Coverage increased (+0.2%) to 90.756% when pulling cd01c59 on djhoese:feature-amsr-l2 into 2d5bfdb on pytroll:master.

@djhoese djhoese marked this pull request as ready for review November 2, 2020 21:30
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.

Thanks for adding the reader! Lots of interesting data in there.

I have some inline comments, but more generally, it would be nice if you could recheck the tests to make sure everything is tested. Codecov is showing some misses, but more seriously the preservation of float types doesn't seem to be tested for example. Are all the features of reader actually tested?

satpy/tests/reader_tests/test_amsr2_l2_gaasp.py Outdated Show resolved Hide resolved
Comment on lines 86 to 95
def start_time(self):
"""Get start time of observation."""
time_str = self.nc.attrs['time_coverage_start']
return datetime.strptime(time_str, "%Y-%m-%dT%H:%M:%S.%fZ")

@property
def end_time(self):
"""Get end time of observation."""
time_str = self.nc.attrs['time_coverage_end']
return datetime.strptime(time_str, "%Y-%m-%dT%H:%M:%S.%fZ")
Copy link
Member

Choose a reason for hiding this comment

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

Looks like the start time and end time is provided in the filename. Could these be checked first, and go into reading the nc values if the filename times aren't available?

Copy link
Member Author

Choose a reason for hiding this comment

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

In my experience the start/end time in the filenames doesn't always match the internal data and it is best to use the file content first. What would be the benefit of using the filename times?

Copy link
Member

Choose a reason for hiding this comment

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

That would be the time the user expects based on the filename. I think the internal time could be confusing.

Copy link
Member Author

Choose a reason for hiding this comment

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

I would assume the internal time is more accurate though. I have also had cases where users expect the same time as in the filename but that doesn't make them right.

Copy link
Member

Choose a reason for hiding this comment

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

I recently noticed that reading the value inside the file takes a significant amount of time when having the files on a shared filesystem over a DSL Internet connection. That happened in a case where the files were provided to satpy but ended not being loaded because the data was elsewhere (viirs sdr reader). With the advance of remote file systems like s3 buckets, I suspect this will be all the more common situation. So, if the times are similar in 99% of the cases, I'd rather use the filename time.
This maybe hints for having two kinds of times in the future, the filename ones (rough estimate) for basic filtering of the data, and a more precise one for applications that need it. But that is another issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this depends on the format being read. I'd have to check, but I have always assumed that xarray.open_dataset with a remote file will always load at least the global attributes. I suppose in this case since start and end are both in the filename I'd be ok doing this though.

satpy/readers/amsr2_l2_gaasp.py Show resolved Hide resolved
satpy/readers/amsr2_l2_gaasp.py Outdated Show resolved Hide resolved
satpy/readers/amsr2_l2_gaasp.py Outdated Show resolved Hide resolved
satpy/readers/amsr2_l2_gaasp.py Show resolved Hide resolved
@djhoese
Copy link
Member Author

djhoese commented Dec 3, 2020

@mraspaud This is ready for re-review. Deepcode is wrong about the 1 issue it found. Otherwise, assuming the tests pass then this should be good to go.

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.

Just a few questions, otherwise looks good. Also some lines aren't covered.

satpy/etc/enhancements/amsr2.yaml Show resolved Hide resolved
satpy/readers/amsr2_l2_gaasp.py Show resolved Hide resolved
satpy/readers/amsr2_l2_gaasp.py Show resolved Hide resolved
@mraspaud mraspaud merged commit def356c into pytroll:master Dec 16, 2020
@djhoese djhoese deleted the feature-amsr-l2 branch December 16, 2020 20:27
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.

None yet

5 participants