Skip to content

fix_ocean_restarts.py bugs #1

@aekiss

Description

@aekiss

There are some bugs in fix_ocean_restarts.py:

  • output_files are based on template_files, not old_files, and then filled in with data from old_files only for fields of shape (1, 75, 2700, 3600), so there are many fields it should fix but doesn't, e.g.
    • eta_t with shape (1, 2700, 3600)
    • t_surf with shape (1, 2700, 3600)
    • advectionu with shape (2, 75, 2700, 3600)
    • dswt with shape (1, 76, 2700, 3600)
    • etc
      Since output_files are based on template_files these variables would then contain values from template_files, not old_files, and so would be inconsistent with fields with shape (1, 75, 2700, 3600) that were replaced with values from old_files.
  • something like out_fp.variables[var][..., level, :, :] = out_data needs to be added to actually write the changes to the file.

I've made a variant of this script called fix_ocean_restarts_cpumask.py which could be used as a starting point, but is designed for cpu mask changes rather than topography changes. fix_ocean_restarts_cpumask.py has different logic:

  • output_files is based on old_files, not template_files
  • all >1-d fields are processed
  • replaces output_files cpu mask with that from template_files
  • replaces newly-unmasked values with values from template_files (this should be fine, since we assume the topography has not changed so the newly-unmasked values will still be in the land mask)
  • leaves old_files data intact everywhere else in output_files

Something different will be needed for fix_ocean_restarts.py, since this is for topography changes rather than cpu mask changes. I think what we want here is to locate the points that are wet with the new bathymetry but were dry with the old one, and replace their values with a nearest-neighbour horizontal extrapolation from old_files, like what we do with initial conditions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions