Skip to content

1862 chlorophyll image import#1894

Merged
nfahlgren merged 23 commits intov5.0from
1862-xarray-imports
Mar 27, 2026
Merged

1862 chlorophyll image import#1894
nfahlgren merged 23 commits intov5.0from
1862-xarray-imports

Conversation

@kmurphy61
Copy link
Copy Markdown
Contributor

@kmurphy61 kmurphy61 commented Mar 23, 2026

Describe your changes
Updating the read_cropreporter.py function so that CHL (chlorophyll) frames are imported as numpy instead of xarray. This will save memory.

Type of update
Is this a:

  • Feature enhancement

Associated issues
Associated with Issue 1862

For the reviewer
See this page for instructions on how to review the pull request.

  • PR functionality reviewed in a Jupyter Notebook
  • All tests pass
  • Test coverage remains 100%
  • Documentation tested
  • New documentation pages added to plantcv/mkdocs.yml
  • Changes to function input/output signatures added to updating.md
  • Code reviewed
  • PR approved

@kmurphy61 kmurphy61 added the cleanup Code quality updates label Mar 23, 2026
@kmurphy61 kmurphy61 linked an issue Mar 23, 2026 that may be closed by this pull request
7 tasks
@deepsource-io
Copy link
Copy Markdown

deepsource-io bot commented Mar 23, 2026

DeepSource Code Review

We reviewed changes in 8852d90...6afc88c on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Coverage  

Code Review Summary

Analyzer Status Updated (UTC) Details
Python Mar 27, 2026 4:24p.m. Review ↗
Test coverage Mar 27, 2026 4:24p.m. Review ↗

Code Coverage Summary

Language Line Coverage (New Code) Line Coverage (Overall)
Aggregate
100%
[✓ above threshold]
99.9%
[▼ down 0.1% from main]
Python
100%
[✓ above threshold]
99.9%
[▼ down 0.1% from main]

➟ Additional coverage metrics may have been reported. See full coverage report ↗

@kmurphy61 kmurphy61 added ready to review update Updates an existing feature/method labels Mar 23, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates CropReporter/PlantExplorer CHL (chlorophyll) import behavior in read_cropreporter to reduce memory usage by storing only the chlorophyll frame as a NumPy array rather than an xarray DataArray, with accompanying documentation updates.

Changes:

  • Update CHL processing to extract/store only the Chl frame (dropping Fdark) as a NumPy array on ps.chlorophyll.
  • Adjust CHL debug output to write a single-frame image instead of faceted xarray plots.
  • Update read_cropreporter documentation to reflect the CHL storage change.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
plantcv/plantcv/photosynthesis/read_cropreporter.py Changes CHL import from xarray DataArray cube to a single NumPy frame stored on ps.chlorophyll.
docs/photosynthesis_read_cropreporter.md Updates user-facing documentation to describe CHL output changes (needs terminology/consistency fixes).
Comments suppressed due to low confidence (1)

plantcv/plantcv/photosynthesis/read_cropreporter.py:24

  • read_cropreporter now stores ps.chlorophyll as a NumPy array (and not exclusively xarray), but the docstring still says the return is "photosynthesis data in xarray DataArray format" and uses PSII_Data instead of the PSII_data class name. Please update the return description/type wording to reflect the mixed xarray/NumPy contents and correct the class naming for accuracy.
    Read datacubes from PhenoVation B.V. CropReporter or PlantExplorer cameras into a PSII_Data instance.

    Inputs:
        filename        = .INF filename

    Returns:
        ps               = photosynthesis data in xarray DataArray format

    :param filename: str
    :return ps: plantcv.plantcv.classes.PSII_data
    """

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

kmurphy61 and others added 6 commits March 24, 2026 13:55
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@joshqsumner joshqsumner self-requested a review March 27, 2026 14:20
Copy link
Copy Markdown
Contributor

@joshqsumner joshqsumner left a comment

Choose a reason for hiding this comment

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

I think this is good per the rest of the cropreporter stuff, it works for me locally and seems clean.
I took a cursory stab at monkeypatching the tests and it wasn't super forthcoming with how many unexported functions are used in the main readers. Goal was to reduce the amount of stuff in the testdata that only pertains to these cropreporter functions since a 12Mb dataset felt very large.
Looking more broadly, I don't think adding this new test data is unreasonable but it may be worth some effort to clean all the cropreporter tests up to use fewer large files. I am not sure which of these could be combined if any, but there are some large files in here and some are duplicated just different by 1 character in the filename.

(plantcv) josh@Precision-7550:~/plantcv$ find tests/testdata -type f -exec du -ah {} + | grep -v "/$" | sort -rh | head -15
53M	tests/testdata/cropreporter_pmt/PMT_E0001P0007N0001_GCU24100090_20260226.DAT
51M	tests/testdata/cropreporter_v441/PSII_PSL_020321_WT_TOP_1.DAT
51M	tests/testdata/cropreporter_v441/PSII_PSD_020321_WT_TOP_1.DAT
42M	tests/testdata/cropreporter_v653/PSL_dark_light.DAT
42M	tests/testdata/cropreporter_v653/PSD_dark_light.DAT
24M	tests/testdata/cropreporter_v653/PML_dark_light.DAT
24M	tests/testdata/cropreporter_v653/PMD_dark_light.DAT
18M	tests/testdata/cropreporter_v653/CLR_dark_light.DAT
18M	tests/testdata/cropreporter_gfp/GFP_DYSeed_20251222191634684.DAT
15M	tests/testdata/cropreporter_npq/PSII_NPQ_020321_WT_TOP_1.DAT
12M	tests/testdata/cropreporter_v653/CHL_dark_light.DAT
12M	tests/testdata/cropreporter_rfp/RFP_DYSeed_20251222191634684.DAT
12M	tests/testdata/cropreporter_chl/CHL_2025-12-12_tob1-ojip_20251212213103380.DAT
12M	tests/testdata/cropreporter_aph/APH_2025-12-12_tob1_20251212205712029.DAT
9.7M	tests/testdata/colorcard_img.png

@joshqsumner
Copy link
Copy Markdown
Contributor

Forgot to push local changes before submitting approval, just stylistic some docstring edits

@joshqsumner joshqsumner self-requested a review March 27, 2026 15:53
Copy link
Copy Markdown
Contributor

@joshqsumner joshqsumner left a comment

Choose a reason for hiding this comment

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

@nfahlgren per dev meeting conversation I removed the additional test data and used the chl data from v441.

@nfahlgren nfahlgren added this to the PlantCV v5.0 milestone Mar 27, 2026
@nfahlgren nfahlgren merged commit 8bc0c1c into v5.0 Mar 27, 2026
5 checks passed
@nfahlgren nfahlgren deleted the 1862-xarray-imports branch March 27, 2026 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Code quality updates ready to review update Updates an existing feature/method

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add new methods to photosynthesis functions

4 participants