Skip to content

Feature/794 aero resistance#807

Merged
vgro merged 11 commits intodevelopfrom
feature/794_aero_resistance
Apr 1, 2025
Merged

Feature/794 aero resistance#807
vgro merged 11 commits intodevelopfrom
feature/794_aero_resistance

Conversation

@vgro
Copy link
Copy Markdown
Collaborator

@vgro vgro commented Mar 28, 2025

This PR moves the initialisation of aerodynamic resistances to the hydrology model because the variable will be required for the canopy evaporation. If the VE runs with abiotic_simple, these are otherwise not inilialised. The actual calculation of aero resistance in canopy remains in the abiotic model. The implementation there is still tentative, fixing that is a separate issue.
@sallymatson and @davidorme you have seen this before, it is the branch that we lost in the GitHub void.

Fixes #794

Type of change

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist

  • Make sure you've run the pre-commit checks: $ pre-commit run -a
  • All tests pass: $ poetry run pytest

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works
  • Relevant documentation reviewed and updated

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.09%. Comparing base (856eb52) to head (f2b4ba2).
⚠️ Report is 2325 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #807      +/-   ##
===========================================
+ Coverage    94.08%   94.09%   +0.01%     
===========================================
  Files           74       74              
  Lines         5220     5229       +9     
===========================================
+ Hits          4911     4920       +9     
  Misses         309      309              

☔ 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.

@vgro vgro requested review from davidorme and sallymatson March 28, 2025 14:38
Copy link
Copy Markdown
Collaborator

@sallymatson sallymatson left a comment

Choose a reason for hiding this comment

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

Made one comment.. otherwise, LGTM !

Comment on lines +123 to +149
# Friction velocity, [m s-1]
# friction_velocity = wind.calculate_friction_velocity(
# reference_wind_speed=data["wind_speed_ref"]
# .isel(time_index=time_index)
# .to_numpy(),
# reference_height=(
# data["layer_heights"][0].to_numpy()
# + abiotic_constants.wind_reference_height
# ),
# roughness_length=roughness_length,
# zero_plane_displacement=zero_plane_displacement,
# von_karman_constant=core_constants.von_karmans_constant,
# )

# Aerodynamic resistance canopy, [s m-1]
# TODO The current implementation returns quite high values at the top canopy
# There seems to be an issue with fluxes as, needs to be checked when fixing
# temperature update function. Could have to do with low wind speeds.
# aerodynamic_resistance_canopy = energy_balance.calculate_aerodynamic_resistance(
# wind_heights=data["layer_heights"][
# layer_structure.index_filled_canopy
# ].to_numpy(),
# roughness_length=roughness_length,
# zero_plane_displacement=zero_plane_displacement,
# friction_velocity=friction_velocity,
# von_karman_constant=core_constants.von_karmans_constant,
# )
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Are these things you want to leave in?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

yes, I have moved this in and out in the past, it produces totally wrong values and I think it is due to the numbers I put in, not the function itself. I don't want to do it in this PR because it's a more general issue with time intervals.

@vgro vgro merged commit 81d96d9 into develop Apr 1, 2025
16 checks passed
@vgro vgro deleted the feature/794_aero_resistance branch April 1, 2025 12:07
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.

move calculation of aerodynamic resistance to hydrology model

3 participants