-
Notifications
You must be signed in to change notification settings - Fork 9
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
Scale data in Comparer #490
Comments
Quick suggestion before 🎅🎄 I think you want to apply the unit conversion to all variables of a specfied quantity. Example of syntax: from typing import Callable
import modelskill as ms
def convert_units(quantity: ms.quantity, new_unit:str, func:Callable[[float],float]) -> ms.Comparer:
"""
Convert values for a quantity to new units
Parameters
----------
quantity : ms.quantity
The quantity to convert
new_unit : str
The new unit to convert to
func : Callable[[float],float]
Conversion function """
...
cmp.convert_units(ms.Quantity('Water level', 'm'), new_unit="cm", func=lambda x: x*100) |
I wonder if this should rather be a
|
It can certainly be useful to scale data in a comparison between model and observation, but can already be handled in a pre-processing step by the data processing library (pandas, mikeio, xarray). |
I propose a new method
scale()
inComparer
andComparerCollection
that should scale all primary variables (not aux data) by a factor and set a new unit. The use case is e.g. that want to show all my plots, tables etc with "cm" unit instead of "meter" but all the data files are in meter so it is a bit cumbersome to change the units before the comparison (it would require me to load all the data in the dfsu).scale(factor=None, *, offset=None, new_unit=None)
new_unit
argument should be required if factor is not None and old unit is not undefined.The text was updated successfully, but these errors were encountered: