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

Add support for unitful #70

Merged
merged 5 commits into from
Aug 29, 2024
Merged

Add support for unitful #70

merged 5 commits into from
Aug 29, 2024

Commits on Aug 29, 2024

  1. Remove extra line

    Sbozzolo committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    2083b89 View commit details
    Browse the repository at this point in the history
  2. Add support for Unitful

    This commit adds support for physical units managed by Unitful.jl.
    
    Unitful is added as an extension. Currently, ClimaAnalysis.jl always
    includes this extension (and Unitful is a hard dependency of
    ClimaAnalysis), but this opens a pathway to making Unitful an optional
    dependency in the future if we decide to do so. (I am taking this idea
    from Unitful itself.)
    
    The technical choice on how to integrate Unitful is the following:
    
    In the constructor, ClimaAnalysis scans for the `units` keyword in the
    attributes. When found, we try to parse it with `Unitful.uparse`. If
    possible, we replace the value for `units` in `attributes` with the
    `Unitful` version. If it is not possible, we leave the string.
    
    When units are requested with `ClimaAnalysis.units`, we always return a
    string.
    
    The choice being made here is that we modify the input given (from
    `String` to `Unitful`), instead of creating a separate box where to put
    this information. The reason for this choice is that it removes the need
    to keep information synced and provide a single ground truth of what
    units are.
    
    We also decide to not attach units directly to `data` to avoid
    performance penalties with manipulating large arrays.
    Sbozzolo committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    de9a146 View commit details
    Browse the repository at this point in the history
  3. Make is_z_1D more general

    Sbozzolo committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    de033cb View commit details
    Browse the repository at this point in the history
  4. Move extensions to better namespace

    Extensions could have name collisions, adding ClimaAnalysis in front
    dramatically reduces the likelihood and follows conventions.
    Sbozzolo committed Aug 29, 2024
    Configuration menu
    Copy the full SHA
    e77641d View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    52416ea View commit details
    Browse the repository at this point in the history