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

A new reader for the netcdf sent to Icare by Meteo-France. #2911

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

Conversation

lperier
Copy link

@lperier lperier commented Sep 27, 2024

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

@mraspaud
Copy link
Member

pre-commit.ci autofix

@mraspaud
Copy link
Member

@lperier thanks for adding this reader!

As you can see, the CI is complaining about a few things, that would be nice to fix as many as possible.

Another important point is adding tests for this new reader. The way we do it nowadays is to generate a data file in a temporary directory (using pytest's tmp_path), run the reader and check what is being read.

@lperier lperier marked this pull request as draft September 30, 2024 16:46
@mraspaud
Copy link
Member

@lperier the error that is now in the tests is because of an external issue. If you merge your branch with main, it should disappear.

@lperier lperier marked this pull request as ready for review October 15, 2024 12:49
Copy link

codecov bot commented Oct 15, 2024

Codecov Report

Attention: Patch coverage is 89.09370% with 71 lines in your changes missing coverage. Please review.

Project coverage is 96.01%. Comparing base (9e3b342) to head (8bebfc1).
Report is 325 commits behind head on main.

Files with missing lines Patch % Lines
satpy/readers/geos_netcdficare.py 82.65% 68 Missing ⚠️
satpy/tests/reader_tests/test_geos_netcdficare.py 98.84% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2911      +/-   ##
==========================================
- Coverage   96.06%   96.01%   -0.05%     
==========================================
  Files         373      379       +6     
  Lines       54465    55813    +1348     
==========================================
+ Hits        52321    53589    +1268     
- Misses       2144     2224      +80     
Flag Coverage Δ
behaviourtests 3.89% <0.00%> (-0.10%) ⬇️
unittests 96.10% <89.09%> (-0.06%) ⬇️

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.

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.

I added a few comments inline.
In general, try to follow the python coding guidelines. There are some more coding guidelines here: https://pytroll.github.io/guidelines.html

If you install ruff, it will help you spot style issues in your code also.

Comment on lines 117 to 122
# chunk_bytes = self._chunk_bytes_for_resolution()
chunk_bytes = '128 MiB'
# chunk_bytes = '64 MiB'

# with dask.config.set(**{'array.slicing.split_large_chunks': True}) :
with dask.config.set({"array.chunk-size": chunk_bytes}) :
Copy link
Member

Choose a reason for hiding this comment

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

This should be set by the user outside of satpy, so this code needs to be removed.

self.metadata["end_time"] = self.get_endOrStartTime(
"time_coverage_end")

print(
Copy link
Member

Choose a reason for hiding this comment

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

Satpy uses logging, not printing... see other readers.

Comment on lines 143 to 144
self.longitudeReelle = self.satlon()
self.longitudedeprojection = self.projlon()
Copy link
Member

Choose a reason for hiding this comment

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

Please use variable names in english, and snake_case, not CamelCase :)

--------
Here is an example how to read the data in satpy:

from satpy import Scene
Copy link
Member

Choose a reason for hiding this comment

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

Satpy uses 4 space indentations, not tabs

Comment on lines 96 to 97
# from netCDF4 import Dataset
# from xarray import DataArray
Copy link
Member

Choose a reason for hiding this comment

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

Should be remove if not needed

Comment on lines 102 to 103
# from satpy._compat import cached_property
# from satpy.utils import get_dask_chunk_size_in_bytes
Copy link
Member

Choose a reason for hiding this comment

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

should be removed if not needed

# from satpy.utils import get_dask_chunk_size_in_bytes
import dask
from satpy.readers import open_file_or_filename
# import math
Copy link
Member

Choose a reason for hiding this comment

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

Should be removed if not needed.


# Reading the needed attributes.
self.initialisation_dataset()
# __init__()
Copy link
Member

Choose a reason for hiding this comment

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

Remove.

print(
"Unsupported satellite platform : " +
self.plateforme)
exit(1)
Copy link
Member

Choose a reason for hiding this comment

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

Please use exceptions, not exitting.

self.plateforme)
exit(1)

# sensor_name()
Copy link
Member

Choose a reason for hiding this comment

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

This function should return the sensor name. Also, we try to avoid setting attributes in methods other than __init__

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