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

Simplify and standardize dimensions and coordinates #151

Merged
merged 6 commits into from
Dec 30, 2024
Merged

Conversation

sjdaines
Copy link
Member

@sjdaines sjdaines commented Dec 29, 2024

Simplify and align with Common Data Model

Overall design:

  • dimensions now just have a name and a size
  • coordinates can optionally be attached to a dimension (currently this are separate Dicts etc)
  • coordinates are specified by (coordinate) variable name which is a "standard" PALEO variable. Coordinate values then are looked up as needed

Changes:

  • NamedDimension now just contains name, size. Remove FixedCoord (simpler version now in PALEOmodel)
  • add functions get_dimensions get_dimension set_coordinates! get_coordinates
  • simplify grids
    • remove coordinates, which can now be defined as "standard" PALEO variables
    • remove get_region (similar functionality now in PALEOmodel)

Simplify and align with Common Data Model

Overall design:
- dimensions now just have a name and a size
- coordinates can optionally be attached to a dimension
  (currently this are separate Dicts etc)
- coordinates are specified by (coordinate) variable name
  which is a "standard" PALEO variable.
  Coordinate values then  are looked up as needed

Changes:
- NamedDimension now just contains name, size.
  Remove FixedCoord (simpler version now in PALEOmodel)
- add functions
    get_dimensions
    get_dimension
    set_coordinates!
    get_coordinates
- simplify grids
  - remove coordinates, which can now be defined as "standard" PALEO variables
  - remove get_region (similar functionality now in PALEOmodel)
- Experimental implementation of Julia CommonDataModel interface
  in CommonDataModelExt extension.
sjdaines added a commit to PALEOtoolkit/PALEOmodel.jl that referenced this pull request Dec 29, 2024
Simplify and align with Common Data Model

See corresponding PALEOboxes PR PALEOtoolkit/PALEOboxes.jl#151

TODO: this commit still includes old and now unused code

Changes:

- Add FixedCoord from PALEOboxes
  - generalized to handle 'bounds' ie Array size(2, ncells)
    as a simpler way of specifying cell edges (cf CF conventions)
- OutputMemory now based on FieldRecord, not DataFrame
  - save / load to jld2 removed
  - updates to netcdf output format
- Simpler and more generic get_array -> FieldArray from FieldRecord
  - replaces old approach using get_region
sjdaines added a commit to PALEOtoolkit/PALEOsediment.jl that referenced this pull request Dec 30, 2024
…s updates

See PRs:
    PALEOtoolkit/PALEOboxes.jl#151
    PALEOtoolkit/PALEOmodel.jl#107

Example of change needed from ReactionSedimentGridn1D do_sediment_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 changed the title Work-in-progress updating dimensions and coordinates Simplify and standardize dimensions and coordinates Dec 30, 2024
@sjdaines sjdaines marked this pull request as ready for review December 30, 2024 20:40
@sjdaines sjdaines merged commit fb92d7b into main Dec 30, 2024
3 checks passed
sjdaines referenced this pull request in PALEOtoolkit/PALEOmodel.jl Dec 31, 2024
Simplify and tidy up FieldRecord and netcdf output
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