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 scanline acquisition times to hrit_jma #1185

Merged
merged 9 commits into from
May 13, 2020

Conversation

sfinkens
Copy link
Member

@sfinkens sfinkens commented May 6, 2020

Add scanline acquisition times to the hrit_jma reader.

Example:

In [1]: import satpy                                                                                                                                                                                                                         
In [2]: import glob                                                                                                                                                                                                                                                                                                                                                                                                                                                        
In [3]: scene = satpy.Scene(filenames=glob.glob('/data/georing/ahi_hrit/*2018011109*'), 
   ...:                     reader='ahi_hrit')                                                                                                                                                                                               
In [4]: scene.load(['B14'])                                                                                                                                                                                                                  
In [5]: scene['B14']['acq_time']                                                                                                                                                                                                             
Out[5]: 
<xarray.DataArray 'acq_time' (y: 5500)>
array(['2018-01-11T09:00:20.995200000', '2018-01-11T09:00:21.055948000',
       '2018-01-11T09:00:21.116695000', ...,
       '2018-01-11T09:09:40.226990000', '2018-01-11T09:09:40.287895000',
       '2018-01-11T09:09:40.348800000'], dtype='datetime64[ns]')
Coordinates:
    acq_time  (y) datetime64[ns] 2018-01-11T09:00:20.995200 ... 2018-01-11T09:09:40.348800
    crs       object +proj=geos +lon_0=140.7 +h=35785831 +x_0=0 +y_0=0 +a=6378169 +b=6356583.8 +units=m +no_defs +type=crs
  * y         (y) float64 5.5e+06 5.498e+06 5.496e+06 ... -5.496e+06 -5.498e+06
Attributes:
    long_name:  Scanline acquisition time

Tested with JAMI (non-segmented), MTSAT-2 Imager (both segmented and non-segmented) and AHI (segmented).

  • Tests added
  • Tests passed
  • Passes flake8 satpy
  • Fully documented

@sfinkens sfinkens requested review from djhoese and mraspaud as code owners May 6, 2020 10:28
@sfinkens sfinkens requested a review from pnuu May 6, 2020 10:28
@sfinkens
Copy link
Member Author

sfinkens commented May 6, 2020

This also fixes the problem, that datasets loaded with the jma_hrit readers currently have ds.attrs['end_time'] = ds.attrs['start_time'] + 15 minutes, because this is hard coded in hrit_base: https://github.com/pytroll/satpy/blob/master/satpy/readers/hrit_base.py#L173

@sfinkens sfinkens changed the title Feature hrit jma acq time Add scanline acquisition times to hrit_jma May 6, 2020
@sfinkens sfinkens self-assigned this May 6, 2020
@sfinkens sfinkens added component:readers enhancement code enhancements, features, improvements labels May 6, 2020
lines_sparse = [int(s.split(':=')[1]) for s in splits[0::2]]
times_sparse = [float(s.split(':=')[1]) for s in splits[1::2]]

if self.platform == HIMAWARI8:
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 case you wonder why only Himawari-8 is checked: The projection name in the header defines the platform, but at the moment it is identical for Himawari-8 and 9 (GEOS(140.70)). So there is no way to distinguish them.

Copy link
Member

Choose a reason for hiding this comment

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

Great move, JMA...

Copy link
Member

Choose a reason for hiding this comment

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

Isn't that because the design of the two platforms is that they aren't meant to be used (in operations) at the same time?

Copy link
Member Author

Choose a reason for hiding this comment

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

That might be an explanation!

@coveralls
Copy link

coveralls commented May 6, 2020

Coverage Status

Coverage increased (+0.02%) to 89.635% when pulling 89988ea on sfinkens:feature-hrit-jma-acq-time into ef24f29 on pytroll:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 89.629% when pulling a7fffb8 on sfinkens:feature-hrit-jma-acq-time into ef24f29 on pytroll:master.

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, just a couple documentation comments and a question

lines_sparse = [int(s.split(':=')[1]) for s in splits[0::2]]
times_sparse = [float(s.split(':=')[1]) for s in splits[1::2]]

if self.platform == HIMAWARI8:
Copy link
Member

Choose a reason for hiding this comment

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

Great move, JMA...

@sfinkens sfinkens requested a review from sjoro as a code owner May 7, 2020 09:58
sfinkens added 2 commits May 7, 2020 12:00
int becomes np.int_ which is platform dependent. Use np.int64
instead.
@codecov
Copy link

codecov bot commented May 11, 2020

Codecov Report

Merging #1185 into master will increase coverage by 0.02%.
The diff coverage is 96.15%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1185      +/-   ##
==========================================
+ Coverage   89.61%   89.63%   +0.02%     
==========================================
  Files         200      200              
  Lines       29504    29600      +96     
==========================================
+ Hits        26439    26532      +93     
- Misses       3065     3068       +3     
Impacted Files Coverage Δ
satpy/readers/hrit_jma.py 97.94% <92.59%> (-1.22%) ⬇️
satpy/readers/seviri_l1b_hrit.py 92.18% <100.00%> (ø)
satpy/tests/reader_tests/test_ahi_hrit.py 100.00% <100.00%> (ø)
satpy/readers/yaml_reader.py 95.30% <0.00%> (-0.13%) ⬇️
satpy/writers/geotiff.py 90.74% <0.00%> (ø)
satpy/readers/seviri_l1b_native.py 71.96% <0.00%> (ø)
satpy/tests/reader_tests/test_fci_l1c_fdhsi.py 100.00% <0.00%> (ø)
satpy/tests/reader_tests/test_seviri_l1b_native.py 95.16% <0.00%> (ø)
satpy/tests/test_scene.py 99.72% <0.00%> (+<0.01%) ⬆️
satpy/readers/__init__.py 95.10% <0.00%> (+0.01%) ⬆️
... and 3 more

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 a82e4a6...89988ea. Read the comment docs.

@mraspaud mraspaud merged commit 10d5e11 into pytroll:master May 13, 2020
@sfinkens sfinkens deleted the feature-hrit-jma-acq-time branch October 18, 2024 15:44
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.

4 participants