Skip to content

Quantile forest package warning and tests - #2459

Open
Kat-90 wants to merge 15 commits into
metoppv:masterfrom
Kat-90:quantile_forest
Open

Kat-90 wants to merge 15 commits into
metoppv:masterfrom
Kat-90:quantile_forest

Conversation

@Kat-90

@Kat-90 Kat-90 commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Addresses #GitHubissuenum

As an IMPROVER developer I would like to add a warning to check whether quantile_forest is installed in our environment or not.
The PR also adds the quantile_forest package to environment_a for use with unit testing.

Testing:

  • Ran tests and they passed OK
  • Added new tests for the new feature(s)

CLA

  • If a new developer, signed up to CLA

@Kat-90 Kat-90 assigned Kat-90 and unassigned Kat-90 Oct 9, 2026
@gavinevans gavinevans mentioned this pull request Oct 12, 2026
2 tasks done

@gavinevans gavinevans left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @Kat-90 👍

A couple of minor comments.

Comment thread envs/environment_a.yml Resolved

"""
if not self.quantile_forest_installed:
msg = "The quantile_forest package is not installed. No parquet files have been processed."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think I might make this something like, including updating the package name:

Suggested change
msg = "The quantile_forest package is not installed. No parquet files have been processed."
msg = "The quantile-forest package is not installed. Skipping training of Quantile Regression Random Forests."

@Kat-90 Kat-90 assigned gavinevans and unassigned Kat-90 Oct 19, 2026

@gavinevans gavinevans left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @Kat-90 👍

I've added one comment.

Comment on lines +1321 to +1322
"The quantile_forest package is not installed. "
"No parquet files have been processed."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This warning message needs to be updated to match the warning message raised in the plugin. Without this update, the GitHub Actions are failing: https://github.com/metoppv/improver/actions/runs/39250826986/job/118053905714?pr=2459

@gavinevans gavinevans assigned Kat-90 and unassigned gavinevans Oct 20, 2026
@Kat-90 Kat-90 assigned gavinevans and unassigned Kat-90 Oct 21, 2026

@bayliffe bayliffe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A couple of questions.

Comment thread envs/environment_a.yml Outdated
- sphinx-book-theme
- sphinx-gallery
- threadpoolctl
- xarray

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@gavinevans & @Kat-90 is there a reason we are not adding these component to the latest.yml environment? I can see some value in keeping environment_b.yml without to test how the code performs with missing packages, but having these in latest would help alert us to issues coming out of package upgrades; I believe that's what the environment is for.

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.

This is done now

forecast_df[column] = pd.to_datetime(
forecast_df[column], unit="ns", utc=True
)
forecast_df[column] = pd.to_datetime(forecast_df[column], utc=True)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm a bit lost. The elements we read in here are assigned units of seconds because we force them to be so in the FORECAST_SCHEMA. We then set the units to ns. The values are unchanged throughout, we just change the units.

Why not modify the schema to have the units you want?
Why do we want ns rather than the pandas>3 default of us?
If we just stuck with actual factual s we could get rid of the seconds_to_ns that is applied our forecast_periods above.

I'm sure there are reasons that are passing me by, so just checking.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We're now consistently using seconds as the unit for the time coordinates.

Standardise unit handling in train QRF code
Comment thread envs/environment_a.yml
- pygam<0.11
- pysteps
- python-stratify
- quantile-forest

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

From the GitHub Actions: https://github.com/metoppv/improver/actions/runs/41612397845/job/125837287693?pr=2459#step:9:742, it seems like we need to include pyarrow as a dependency in both of these environments.

@gavinevans gavinevans assigned bayliffe and unassigned gavinevans and Kat-90 Nov 5, 2026

@bayliffe bayliffe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks.

I assume this code will now be incompatible with our operational tables without some conversion, is that right and should it be documented for anyone trying to reuse those tables in experiments?

@bayliffe bayliffe removed their assignment Nov 6, 2026

This branch has not been deployed

No deployments
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