Skip to content

Add FCI LSA SAF FRP csv reader support - #3434

Open
alexhalbig wants to merge 10 commits into
pytroll:mainfrom
alexhalbig:feature-add-frp-mtg-reader
Open

Add FCI LSA SAF FRP csv reader support#3434
alexhalbig wants to merge 10 commits into
pytroll:mainfrom
alexhalbig:feature-add-frp-mtg-reader

Conversation

@alexhalbig

@alexhalbig alexhalbig commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR adds tests for the FCI LSA SAF FRP L2 CSV reader.
Including yaml-, utest-, composite-, and enhancement-files

Work finished, based on PWC Spring 2026 Issue - Closes #3350

Testing

  • pre-commit run --all-files
  • ruff check . --fix
  • ruff format .
  • relevant local unit tests passed

@codecov

codecov Bot commented Aug 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.32%. Comparing base (26c746c) to head (b9ac0eb).
⚠️ Report is 69 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3434      +/-   ##
==========================================
- Coverage   96.33%   96.32%   -0.02%     
==========================================
  Files         467      467              
  Lines       59142    59274     +132     
==========================================
+ Hits        56977    57096     +119     
- Misses       2165     2178      +13     
Flag Coverage Δ
behaviourtests 3.57% <0.00%> (-0.02%) ⬇️
unittests 96.41% <100.00%> (-0.02%) ⬇️

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

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ameraner ameraner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice job, thank you for this! Just some minor comments/questions/edits, and a requried change for the pixel coordinates.

Comment thread satpy/etc/enhancements/fci.yaml
Comment thread satpy/readers/fci_lsasaf_frp_l2_csv.py Outdated
Comment thread satpy/readers/fci_lsasaf_frp_l2_csv.py Outdated
Comment thread satpy/readers/fci_lsasaf_frp_l2_csv.py Outdated
Comment thread satpy/readers/fci_lsasaf_frp_l2_csv.py Outdated
Comment thread satpy/readers/fci_lsasaf_frp_l2_csv.py Outdated
Comment thread satpy/readers/fci_lsasaf_frp_l2_csv.py Outdated
Comment thread satpy/readers/fci_lsasaf_frp_l2_csv.py Outdated
Comment thread satpy/readers/fci_lsasaf_frp_l2_csv.py Outdated
Comment on lines +118 to +121
data = data.assign_coords({
"longitude": ("y", lons),
"latitude": ("y", lats),
})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

maybe I'm missing something, but what is the point of adding the lon-lat as coordinates on y here, if we then immediately after remap the data on the 2-d array?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You are right. Dimensions are not needed here.
Removed assign_cords()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

could it be that the change was not pushed? The assign_coords is still there

Comment thread satpy/readers/fci_lsasaf_frp_l2_csv.py Outdated
@ameraner ameraner added enhancement code enhancements, features, improvements component:readers PCW Pytroll Contributors' Week labels Aug 12, 2026
@alexhalbig

Copy link
Copy Markdown
Contributor Author

The CI run still fails in the two TestParallaxCorrectionModifier.test_modifier_interface_cloud_moves_to_observer cases for foroyar. The failure is caused by an unevaluated Dask boolean array:
assert dask.array<all-aggregate, shape=(), dtype=bool, ...>

This behavior surprises me, as the CI tests passed 2 days ago. The changes made, suggested by Andreas Review, should not impact the testing success in my opinion.

My branch is not behind origin/main (HEAD...origin/main = 8 0). Could you please confirm whether this is a known Dask/Pyresample compatibility issue and whether these two tests should be adjusted or marked as expected failures?

@ameraner ameraner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for the updates! I noticed a couple of things, see below.

The failing tests are not due to your changes, they're probably due to some library update that broke the parallax tests.. they will need to be fixed separately (feel free to give it a go in another PR if you have time).

Comment thread satpy/etc/readers/lsasaf_mtgfrp_l2.yaml Outdated
Comment on lines +16 to +19
nc_fci_frp:
file_reader: !!python/name:satpy.readers.fci_lsasaf_frp_l2_nc.FRPFileHandler
file_patterns:
- 'W_PT-{facility_or_tool},SATELLITE,LSA-509_{platform_name}_MTFRPPIXEL_MTG-{coverage}_{disposition_mode}_LPMG_{start_time:%Y%m%d%H%M%S}.nc'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

until we really support nc, this should be removed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I thought one step in advance, as I just need to finish the utests for the nc-reader. But I agree with you. Will be removed here, and added later.

Comment thread satpy/readers/fci_lsasaf_frp_l2_csv.py Outdated
Comment on lines +118 to +121
data = data.assign_coords({
"longitude": ("y", lons),
"latitude": ("y", lats),
})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

could it be that the change was not pushed? The assign_coords is still there

Comment thread satpy/readers/fci_lsasaf_frp_l2_csv.py Outdated
Comment on lines +142 to +148
grid = np.full(FRP_GRID_SHAPE, np.nan, dtype=np.float32)
grid[rows_int, cols_int] = values
xarr = xr.DataArray(
grid,
dims=("y", "x"),
attrs=attrs,
)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The grid array here should be daskified to adhere to the normal format of reader outputs, and to optimise memory usage. You can take inspiration from an old version of the LI L2 reader to do that: https://github.com/pytroll/satpy/blame/618fc0e498c7f1e1bfce011f1ed1b041895ed8ce/satpy/readers/li_l2_nc.py#L141-L148
(in that reader, later on we needed an np.add.at functionality - so if you look at the current reader it is much more complex. However you don't need that here, since we have only one value per pixel, hence my link to an older blame version).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks this was helpful. The new version is daskified now.

@gerritholl

Copy link
Copy Markdown
Member

I confirm that tests are failing in satpy main after mamba update --all in my local environment. This is unrelated to the current PR, but must be due to a recent dependency update.

@gerritholl

Copy link
Copy Markdown
Member

The test failures are unrelated to this PR. Satpy main is also failing. See #3441 .

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 PCW Pytroll Contributors' Week

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a reader for LSA SAF FRP

3 participants