Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring near by link appraoch related code and example notebook #139

Merged
merged 31 commits into from Nov 10, 2023

Conversation

maxmargraf
Copy link
Contributor

@maxmargraf maxmargraf commented Oct 27, 2023

This PR should refactor the nearby link approach.
Todos:

  • remove function instantaneous_to_minmax_data()
  • move the calculation of max(pmin), deltaP and deltaPL to nearby_wetdry()
  • update nearby_determine_reference_level() and nearby_correct_recieved_signals() to make the usage of pmax more intuitive
  • update of the example notebook and its descriptions to match the changes in the functions above
  • update test_nearby_wetdry()
  • update test_nearby_rainfall()

@maxmargraf maxmargraf self-assigned this Oct 27, 2023
@codecov
Copy link

codecov bot commented Oct 30, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (975242b) 75.17% compared to head (bdc0d77) 74.83%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #139      +/-   ##
==========================================
- Coverage   75.17%   74.83%   -0.35%     
==========================================
  Files          29       29              
  Lines        1112     1089      -23     
==========================================
- Hits          836      815      -21     
+ Misses        276      274       -2     
Flag Coverage Δ
unittests 74.83% <100.00%> (-0.35%) ⬇️

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

Files Coverage Δ
pycomlink/processing/nearby_rain_retrival.py 100.00% <100.00%> (+4.00%) ⬆️
pycomlink/processing/wet_dry/nearby_wetdry.py 100.00% <100.00%> (ø)

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

Copy link
Contributor

@cchwala cchwala left a comment

Choose a reason for hiding this comment

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

Thanks for all the updates! I mainly have some comments regarding doc strings, but also one regarding a potential error in the code.

Two additional comment to the notebook:

You can remove that from the first cell I guess

%load_ext autoreload
%autoreload 2

import nearby_rain_retrival as nearby_rain
import nearby_wetdry as nearby_wetdry

I am confused about this part in the last cell

As reference, path-averaged rain rates along the CMLs paths from RADKLIM-YW are provided. This data has a temporal resolution of 5 minutes and is resampled to 15 minute rainfall intensities.

But then you do

path_ref.sel(cml_id=i).rainfall_amount.resample(time="15min").sum() * 4)

If path_ref is already the 5-minute rain rate from RADKLIM-YW (as stated in your text), it should be best to just do .resample(time="15min").mean(), right? Or is path_ref` not a rain rate? Either your text or you code is wrong.

pycomlink/processing/nearby_rain_retrival.py Outdated Show resolved Hide resolved
pycomlink/processing/nearby_rain_retrival.py Outdated Show resolved Hide resolved
pycomlink/processing/nearby_rain_retrival.py Outdated Show resolved Hide resolved
pycomlink/processing/nearby_rain_retrival.py Outdated Show resolved Hide resolved
pycomlink/processing/nearby_rain_retrival.py Show resolved Hide resolved
pycomlink/processing/nearby_rain_retrival.py Outdated Show resolved Hide resolved
pycomlink/processing/nearby_rain_retrival.py Outdated Show resolved Hide resolved
pycomlink/processing/wet_dry/nearby_wetdry.py Outdated Show resolved Hide resolved
pycomlink/processing/wet_dry/nearby_wetdry.py Outdated Show resolved Hide resolved
pycomlink/processing/wet_dry/nearby_wetdry.py Show resolved Hide resolved
Copy link
Contributor

@cchwala cchwala left a comment

Choose a reason for hiding this comment

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

Thanks for the swift update.

I still found some minor things that should be updated. Then it is ready to merge.

The notebook also looks good now. The plots with the time series of p_c_min and p_c_max really help to understand what the individual variables mean. 👍

pycomlink/processing/nearby_rain_retrival.py Outdated Show resolved Hide resolved
pycomlink/processing/nearby_rain_retrival.py Outdated Show resolved Hide resolved
pycomlink/processing/nearby_rain_retrival.py Outdated Show resolved Hide resolved
@maxmargraf
Copy link
Contributor Author

Thanks for the review comments! Ready to be merged from my side.

@cchwala
Copy link
Contributor

cchwala commented Nov 10, 2023

Thanks a lot again 👏 👏 👏 .

Really good to now have this updated implementation of the nearby-link approach from RAINLINK in Python! 🎉

@cchwala cchwala merged commit eaebe64 into pycomlink:master Nov 10, 2023
5 checks passed
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.

None yet

2 participants