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

Isccpg ng #82

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Isccpg ng #82

wants to merge 13 commits into from

Conversation

ninahakansson
Copy link
Collaborator

Converter for ISCCP-NG to seviri PPS level1c format

  • Closes #xxxx
  • Tests added
  • Tests passed: Passes pytest level1c4pps
  • Passes flake8
  • Fully documented

Nina.Hakansson and others added 4 commits May 25, 2022 18:54
We are using the satpy nc cf reader almost without updates,
 which means lat/lon/time need to be fixed separately.
Copy link

codecov bot commented Nov 16, 2023

Codecov Report

Attention: 53 lines in your changes are missing coverage. Please review.

Comparison is base (1ed7063) 77.61% compared to head (46326cb) 74.88%.
Report is 10 commits behind head on main.

Files Patch % Lines
level1c4pps/isccpng2pps_lib.py 0.00% 53 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #82      +/-   ##
==========================================
- Coverage   77.61%   74.88%   -2.74%     
==========================================
  Files          21       22       +1     
  Lines        1452     1505      +53     
  Branches      107      110       +3     
==========================================
  Hits         1127     1127              
- Misses        301      354      +53     
  Partials       24       24              
Flag Coverage Δ
unittests 74.88% <0.00%> (-2.74%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@coveralls
Copy link

coveralls commented Jul 5, 2024

Pull Request Test Coverage Report for Build 9806060353

Details

  • 2 of 55 (3.64%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-1.9%) to 77.632%

Changes Missing Coverage Covered Lines Changed/Added Lines %
level1c4pps/isccpng2pps_lib.py 0 53 0.0%
Totals Coverage Status
Change from base Build 9806033515: -1.9%
Covered Lines: 1585
Relevant Lines: 1998

💛 - Coveralls

Nina.Hakansson and others added 3 commits November 25, 2024 13:39
@coveralls
Copy link

coveralls commented Nov 27, 2024

Pull Request Test Coverage Report for Build 12372240369

Details

  • 9 of 100 (9.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-3.2%) to 75.123%

Changes Missing Coverage Covered Lines Changed/Added Lines %
level1c4pps/isccpng2pps_lib.py 0 91 0.0%
Totals Coverage Status
Change from base Build 12372197481: -3.2%
Covered Lines: 1651
Relevant Lines: 2151

💛 - Coveralls

The calibration we want is there in satpy. But the calibration that was
used. The nominal is saved with the original data. And it sometimes changes....
And make sure calculations are actually done!
# Conflicts:
#	level1c4pps/__init__.py
Copy link
Contributor

@BengtRydberg BengtRydberg left a comment

Choose a reason for hiding this comment

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

Nice work. Adding some comments that you can consider for readability improvement.

@@ -568,7 +573,7 @@ def compose_filename(scene, out_path, instrument, band=None):
end_time = band.attrs['end_time']
platform_name = scene.attrs['platform']
orbit_number = int(scene.attrs['orbit_number'])
out_path_with_dates = start_time.strftime(out_path)
out_path_with_dates = datetime.strftime(dt64_to_datetime(start_time), out_path)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe worth mentioning in the command line interface help that the out_path can be reformatted in this way.


BANDNAMES = list(PPS_TAGNAMES.keys())

coef_slope_chan = ['refl_00_65um', 'refl_00_86um', 'refl_01_60um',
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe nicer to have put all coefficients related stuff in a yaml file with a format something like this:

coeffcients:
  channels: 
    - refl_00_65um 
    - refl_00_86um
    - refl_01_60um  
    - temp_03_80um
    - temp_06_20um
    - temp_07_30um
    - temp_08_60um  
    - temp_09_70um
    - temp_11_00um
    - temp_12_00um
    - temp_13_30um'
  satellite: 
    GOES-16: 
      day:
        slope: [1.00152, 0.946758, 1.00669, 0.926764, 0.991329, 0.999300, 1.01977, 1.03453, 0.996781, 1.02343, 0.863748]
        offset: [0.000369844, 0.193868, 0.708022, 18.4795, 1.58729, -0.0312020, -4.93224, -7.83331, 1.13395, -5.51940, 30.5574]
      night: 
        ...

"""Nominal calibration is applied, redo with meirnik calibration."""
from satpy.readers.seviri_base import MeirinkCalibrationHandler
start_time = dt64_to_datetime(scene["refl_00_65um"].attrs["start_time"])
channel_name = {"refl_00_65um": "VIS006",
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer to define constants like this and the ones below in the top of the module.

channel_name = {"refl_00_65um": "VIS006",
"refl_00_86um": "VIS008",
"refl_01_60um": "IR_016"}
platform_id = {55: 321,
Copy link
Contributor

Choose a reason for hiding this comment

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

do you actually need the 321 and 324 ids?

"IR_016": 23.112}
}}
for wmo_id in platform_id:
for band in channel_name:
Copy link
Contributor

Choose a reason for hiding this comment

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

you could do: for wmo_id, platform_id in PLATFORM_ID.items(): and for band, channel_name in CHANNEL_NAME.items(): to increase readability if you follow the advise above.

update = ((dwmo_id == wmo_id) & (data > 0) & (sol_zen < dn_discr))
scene[band].values = np.where(update, scene[band].values * k + c, scene[band].values)

if (illum == '_nig'):
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

f" with respect to SEVIRI on MSG4 using y={k} * x + {c}")
dn_discr = 90
if (illum == '_day'):
update = ((dwmo_id == wmo_id) & (data > 0) & (sol_zen < dn_discr))
Copy link
Contributor

Choose a reason for hiding this comment

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

no need for the outermost parenthesis

scene[band].values = np.where(update, scene[band].values * k + c, scene[band].values)

if (illum == '_nig'):
update = ((dwmo_id == wmo_id) & (data > 0) & (sol_zen >= dn_discr))
Copy link
Contributor

Choose a reason for hiding this comment

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

same as above

"""Homogenize data to Meteosat-11."""
sol_zen = scene["sunzenith"]
for band in BANDNAMES:
for wmo_id in [270, 271, 173, 55]:
Copy link
Contributor

Choose a reason for hiding this comment

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

for wmo_id in satellite_names:
     for illumination in ["_day", "_night"]:
         homogenize_channel(scene, wmo_id, illumination, band, sol_zen)


def get_encoding_isccpng(scene):
"""Get netcdf encoding for all datasets."""
return get_encoding(scene,
Copy link
Contributor

Choose a reason for hiding this comment

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

should fit on one line.

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.

3 participants