Metadata-Version: 2.1
Name: scaling
Version: 0.2.3
Summary: convert units using Froude and Reynolds similitude
Home-page: https://github.com/onewhaleid/scaling
Author: Dan Howe
Author-email: d.howe@wrl.unsw.edu.au
License: UNKNOWN
Description: # scaling
        
        Convert quantities between model and prototype scale using Froude and Reynolds similitude.
        
        ## Installation
        
        ```
        pip install scaling
        ```
        
        ## Usage
        
        ```python
        >>> from scaling import FroudeConverter
        >>> froude = FroudeConverter()
        
        >>> # Convert model value of 200 mm to prototype value (m) with scale of 10
        >>> froude.model_to_proto(200,Â length_scale=10,Â input_unit='mm',Â target_unit='m')
        2.0
        
        >>> # Get Froude scaling exponent for quantities of time
        >>>Â froude.scaling_exponent('s')
        0.5
        
        >>> # Get length, mass and time dimensions for quantities of energy
        >>>Â froude.dimensions('kJ')
        'L^2Â M^1Â T^-2'
        ```
        
        Dataframes are also accepted, and specific units can be specified for the values in the index.
        
        ```python
        >>> T = 2
        >>> H = 100
        
        >>> # Generate regular waves with height=100mm, and period=2s
        >>> t = np.arange(0, 10.1, 0.1)
        >>> eta = 0.5 * H * np.sin(t * 2 * np.pi / T)
        
        >>> df_model = pd.DataFrame(index=t, data=eta)
        >>> df_model.columns = ['$\eta$ (mm)']
        >>> df_model.index.name = 'Time (s)'
        
        >>> df_model.plot()
        ```
        
        ![model](https://user-images.githubusercontent.com/11261876/45915234-575e4300-be95-11e8-9edd-30338bd6db2d.png)
        
        ```python
        >>> # Convert to prototype dimensions, with length scale=25
        >>> df_proto = froude.model_to_proto(
                df_model,
                length_scale=25,
                input_unit='mm',
                target_unit='m',
                index_input_unit='s',
                index_target_unit='s')
        
        >>> df_proto.columns = ['$\eta$ (m)']
        >>> df_proto.plot()
        ```
        ![proto](https://user-images.githubusercontent.com/11261876/45915245-6c3ad680-be95-11e8-9912-2dc2afc16b9a.png)
        
        `scaling` uses `pint` for unit and dimension conversions. `pint` is able to interpret a wide range of different input units.
        
        ```python
        >>> # Convert water head model value (mm) to prototype pressure value (kPa)
        >>> froude.model_to_proto(10,Â length_scale=100, 'mm.H20',Â 'kPa')
        9.80665
        
        >>> # Demonstrate different ways of specifying units of newtons
        >>>Â froude.dimensions('N')
        'L^1Â M^1Â T^-2'
        >>>Â froude.dimensions('newton')
        'L^1Â M^1Â T^-2'
        >>>Â froude.dimensions('kg.m/s/s')
        'L^1Â M^1Â T^-2'
        >>>Â froude.dimensions('kilogram.metre/second^2')
        'L^1Â M^1Â T^-2'
        ```
        
        ## Froude scaling reference
        
        | Quantity     | Dimensions    | Scaling exponent |
        |--------------|---------------|------------------|
        | Length       | L^1           | Î»^1              |
        | Mass         | M^1           | Î»^3              |
        | Time         | T^1           | Î»^0.5            |
        | Velocity     | L^1 T^-1      | Î»^0.5            |
        | Acceleration | L^1 T^-2      | Î»^0              |
        | Force        | L^1 M^1 T^-2  | Î»^3              |
        | Pressure     | L^-1 M^1 T^-2 | Î»^1              |
        | Overtopping  | L^2 T^-1      | Î»^1.5            |
        
        
        ## Reynolds scaling reference
        
        | Quantity     | Dimensions    | Scaling exponent |
        |--------------|---------------|------------------|
        | Length       | L^1           | Î»^1              |
        | Mass         | M^1           | Î»^3              |
        | Time         | T^1           | Î»^2              |
        | Velocity     | L^1 T^-1      | Î»^-1             |
        | Acceleration | L^1 T^-2      | Î»^-3             |
        | Force        | L^1 M^1 T^-2  | Î»^0              |
        | Pressure     | L^-1 M^1 T^-2 | Î»^-2             |
        | Overtopping  | L^2 T^-1      | Î»^0              |
        
Platform: UNKNOWN
Description-Content-Type: text/markdown
