sandialabs / seat-qgis-plugin

Spatial Environmental Assessment Toolkit (SEAT) QGIS Plugin
https://sandialabs.github.io/seat-qgis-plugin/
GNU General Public License v3.0
1 stars 6 forks source link

Power module `roundup` #35

Closed ssolson closed 2 weeks ago

ssolson commented 1 month ago

Hey @tnelson-integral I was working on the testing functions today I could use your help looking at this function.

Currently the roundup function in the power module takes a number to round and a base. It will then divide the number by the base. This returned number is then multiplied by the base:

def roundup(x, base=5):
    return base * round(x/base)

E.g.:

roundup(10.333, 3)
>>> 9

So in the example above roundup rounds down to a different number.

I think this is a bug.

Can you help me understand this function?

https://github.com/sandialabs/seat-qgis-plugin/blob/6bd14abbb46fc29160397d98eee085d55d973ec2/seat/modules/power_module.py#L323

tnelson-integral commented 1 month ago

Definitely a bug. I will work on a fix for it. -Thanks, -Tim

Tim Nelson (he/him/his) | Project Scientist Tel: 561.240.5096 | Cell: 803.319.3344 | St. Petersburg | FL @.*** | Biohttps://www.integral-corp.com/staff/timothy-r-nelson-ph-d

https://www.integral-corp.com/[cid:integral_1a04a855-2877-4c4f-bd98-b89de3950d0f.png]https://www.integral-corp.com/


From: ssolson @.> Sent: Friday, July 26, 2024 11:55 AM To: sandialabs/seat-qgis-plugin @.> Cc: Tim Nelson @.>; Mention @.> Subject: [sandialabs/seat-qgis-plugin] Power module roundup (Issue #35)

[CAUTION: External email. Think before you click links or open attachments.]

Hey @tnelson-integralhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_tnelson-2Dintegral&d=DwMCaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=2OT5Kb-Guh1vdHPYH_OKgQqqKZs-WcstcKgpghDlHN8&m=Kqj8dvkeHN8qAkvg5mEJwRkAfzl7rU7mhy8-3fkeK-XrhUWR_2mOUNDiRJ0qP-G0&s=j73eE_gbiCfomq1BDVyImsrvP5b9fObrGzWFmSf44pw&e= I was working on the testing functions today I could use your help looking at this function.

Currently the roundup function in the power module takes a number to round and a base. It will then divide the number by the base. This returned number is then multiplied by the base:

def roundup(x, base=5): return base * round(x/base)

E.g.:

roundup(10.333, 3)

9

So in the example above roundup rounds down to a different number.

I think this is a bug.

Can you help me understand this function?

https://github.com/sandialabs/seat-qgis-plugin/blob/6bd14abbb46fc29160397d98eee085d55d973ec2/seat/modules/power_module.py#L323https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_sandialabs_seat-2Dqgis-2Dplugin_blob_6bd14abbb46fc29160397d98eee085d55d973ec2_seat_modules_power-5Fmodule.py-23L323&d=DwMCaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=2OT5Kb-Guh1vdHPYH_OKgQqqKZs-WcstcKgpghDlHN8&m=Kqj8dvkeHN8qAkvg5mEJwRkAfzl7rU7mhy8-3fkeK-XrhUWR_2mOUNDiRJ0qP-G0&s=nhMnZtjYfIakcerTvqrR17ViQeoPEfidYb8iYLI8yzA&e=

— Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_sandialabs_seat-2Dqgis-2Dplugin_issues_35&d=DwMCaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=2OT5Kb-Guh1vdHPYH_OKgQqqKZs-WcstcKgpghDlHN8&m=Kqj8dvkeHN8qAkvg5mEJwRkAfzl7rU7mhy8-3fkeK-XrhUWR_2mOUNDiRJ0qP-G0&s=Eh2ETZVuuvqc2ynK8ZrssFxbDzRodHcD4ljFFxkN8QA&e=, or unsubscribehttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AZARDBI4VO3TNOLIGJ4BKPLZOJWQFAVCNFSM6AAAAABLQYVVGSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQZTENJSGA3DKMI&d=DwMCaQ&c=euGZstcaTDllvimEN8b7jXrwqOf-v5A_CdpgnVfiiMM&r=2OT5Kb-Guh1vdHPYH_OKgQqqKZs-WcstcKgpghDlHN8&m=Kqj8dvkeHN8qAkvg5mEJwRkAfzl7rU7mhy8-3fkeK-XrhUWR_2mOUNDiRJ0qP-G0&s=fNCUaP1Ki97YbfzN6g8Kju6aN4_B9lWoom9P6hs1PSg&e=. You are receiving this because you were mentioned.Message ID: @.***>

ssolson commented 2 weeks ago

Fixed in #36