Skip to content

MNT: introduce pressure unit conversion when using forecast/reanalysis/ensemble data#955

Open
Lucas-Prates wants to merge 3 commits intodevelopfrom
mnt/change_pressure_unit_netcdf4
Open

MNT: introduce pressure unit conversion when using forecast/reanalysis/ensemble data#955
Lucas-Prates wants to merge 3 commits intodevelopfrom
mnt/change_pressure_unit_netcdf4

Conversation

@Lucas-Prates
Copy link
Copy Markdown
Contributor

@Lucas-Prates Lucas-Prates commented Apr 26, 2026

Pull request type

  • Code maintenance (refactoring, formatting, tests)

Checklist

  • Tests for the changes have been added
  • Docs have been reviewed and added / updated
  • Lint (black rocketpy/ tests/) has passed locally
  • All tests (pytest tests -m slow --runslow) have passed locally
  • CHANGELOG.md has been updated (if relevant)

Current behavior

When set_atmospheric_model is used with the argument file as "forecast", "reanalysis", or "ensemble", the data can be fetched with different pressure units. For instance, when using "forecast" with "GFS", it seem to be 100x higher than they should, as the figures indicate, so they probably use Pa. However, it seems that ERA5 data is in hPa, so the conversion is needed.

New behavior

We previously had a hard conversion from hPa to Pa (100x factor). It was replaced with an argument that allows the user to specify the conversion factor.

It can be considered a breaking change because users who used "reanalysis" with ERA5 will now need to specify that their data is in "hPa", otherwise their pressure levels will be 100x smaller than they should

Breaking change

  • Yes

Additional information

The following figure shows the incorrect pressure values using forecast.
image

As the figure below indicates, the values are 100x higher than the normal range of values

image

@Lucas-Prates Lucas-Prates requested a review from a team as a code owner April 26, 2026 22:56
@Lucas-Prates Lucas-Prates changed the title MNT: remove conversion from mbar to Pa in forecast fetched data ENH: introduce pressure unit conversion when using forecast/reanalysis data Apr 27, 2026
@Lucas-Prates Lucas-Prates changed the title ENH: introduce pressure unit conversion when using forecast/reanalysis data MNT: introduce pressure unit conversion when using forecast/reanalysis data Apr 27, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

❌ Patch coverage is 85.71429% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.11%. Comparing base (9cf3dd4) to head (476e3a8).
⚠️ Report is 72 commits behind head on develop.

Files with missing lines Patch % Lines
rocketpy/environment/environment.py 84.21% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #955      +/-   ##
===========================================
+ Coverage    80.27%   81.11%   +0.84%     
===========================================
  Files          104      113       +9     
  Lines        12769    14555    +1786     
===========================================
+ Hits         10250    11807    +1557     
- Misses        2519     2748     +229     

☔ View full report in Codecov by Sentry.
📢 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.

@Lucas-Prates Lucas-Prates changed the title MNT: introduce pressure unit conversion when using forecast/reanalysis data MNT: introduce pressure unit conversion when using forecast/reanalysis/ensemble data Apr 27, 2026
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