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

io: allow disabling coordinates in history files #935

Merged
merged 3 commits into from
Feb 23, 2024

Commits on Feb 22, 2024

  1. ice_history_shared: add namelist flags for coordinate variables

    Users might not wish for all 8 coordinate variables to be written to
    each history file, so add namelist flags allowing to disable each
    coordinate variable independantly, following the approach used for the
    other grid variables. Move the definition of 'ncoord' from each IO
    backend to 'ice_history_shared'. Note that we already 'use' the whole of
    ice_history_shared in ice_history_write, so we do not need to adjust the
    use statement.
    
    Note that the code that writes these variables in module
    'ice_history_write' in each of the IO backends is not modified, it will
    be adjusted in a following commit.
    phil-blain committed Feb 22, 2024
    Configuration menu
    Copy the full SHA
    1c932dc View commit details
    Browse the repository at this point in the history
  2. io_{netcdf,pio2}/ice_history_write: define coordinates attributes in …

    …a loop
    
    In ice_history_write::ice_write_hist, we initialize the 'var_coord' and
    'coord_bounds' arrays by manually incrementing 'ind' and initializing
    each elements with the corresponding information for each coordinate
    variable. The rest of the code in that subroutine instead uses a loop on
    'ncoord', which is a parameter holding the number of coordinates
    variable, along with 'select' statements.
    
    The latter approach is more elegant and also more flexible if we change
    the number of coordinates variables. Refactor the code to use a loop and
    leverage the integers n_{u,t,n,e}{lon,lat} added in the previous commit,
    in both io_netcdf and io_pio2, which have identical code in this part of
    the subroutine.
    phil-blain committed Feb 22, 2024
    Configuration menu
    Copy the full SHA
    2ac3a29 View commit details
    Browse the repository at this point in the history
  3. io_{netcdf,pio2}/ice_history_write: use namelist flags for coordinate…

    … variables
    
    In order to enable the namelist flags for each coordinate variables
    added in the previous commit, adjust the code of the io_netcdf and
    io_pio2 backends by checking the value of 'icoord(i)' for each loop on
    'ncoord' that calls NetCDF or PIO functions.
    
    Add the new flags to the reference namelist.
    phil-blain committed Feb 22, 2024
    Configuration menu
    Copy the full SHA
    860d163 View commit details
    Browse the repository at this point in the history