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

Sync with PALEOboxes v0.22 / PALEOmodel v0.16 dimensions, coordinates changes #32

Merged
merged 1 commit into from
Dec 30, 2024

Conversation

sjdaines
Copy link
Member

Reactions that create grids updated to use new approach to attach coordinates to dimensions.

Changes are backwards-compatible (ie work with old and new versions of PALEOboxes and PALEOmodel, except for MITgcm transport where changes to grid setup are too large.

Example of changes, from ReactionOceanTransportColumn setup_grid:

    # attach coordinates to grid for output visualisation etc
    if isdefined(PB, :set_coordinates!) # PALEOboxes >= 0.22
        PB.set_coordinates!(rj.domain.grid, "cells", ["zmid", "zlower", "zupper"])
    else
        empty!(rj.domain.grid.z_coords)
        push!(rj.domain.grid.z_coords, PB.FixedCoord("zmid", grid_vars.zmid, PB.get_variable(m, "zmid").attributes))
        push!(rj.domain.grid.z_coords, PB.FixedCoord("zlower", grid_vars.zlower, PB.get_variable(m, "zlower").attributes))
        push!(rj.domain.grid.z_coords, PB.FixedCoord("zupper", grid_vars.zupper, PB.get_variable(m, "zupper").attributes))
    end

… changes

Reactions that create grids updated to use new approach to attach coordinates to dimensions.

Changes are backwards-compatible (ie work with old and new versions of
PALEOboxes and PALEOmodel, *except* for MITgcm transport where changes to grid
setup are too large.

Example of changes, from ReactionOceanTransportColumn setup_grid:

        # attach coordinates to grid for output visualisation etc
        if isdefined(PB, :set_coordinates!) # PALEOboxes >= 0.22
            PB.set_coordinates!(rj.domain.grid, "cells", ["zmid", "zlower", "zupper"])
        else
            empty!(rj.domain.grid.z_coords)
            push!(rj.domain.grid.z_coords, PB.FixedCoord("zmid", grid_vars.zmid, PB.get_variable(m, "zmid").attributes))
            push!(rj.domain.grid.z_coords, PB.FixedCoord("zlower", grid_vars.zlower, PB.get_variable(m, "zlower").attributes))
            push!(rj.domain.grid.z_coords, PB.FixedCoord("zupper", grid_vars.zupper, PB.get_variable(m, "zupper").attributes))
        end
@sjdaines sjdaines merged commit 0f9dbaa into main Dec 30, 2024
3 checks passed
@sjdaines sjdaines deleted the dims_coords branch December 30, 2024 20:05
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.

1 participant