Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mcgibbon
Copy link
Collaborator

@mcgibbon mcgibbon commented Nov 8, 2022

Purpose

This PR refactors all usage of storages to Quantity, other than in test code.

Code changes:

  • get_quantity_halo_spec method is moved from GridIndexing to QuantityFactory
  • all internal temporaries in physics, fv3core, and coupling code are now Quantity instead of storage

Checklist

Before submitting this PR, please make sure:

  • You have followed the coding standards guidelines established at Code Review Checklist.
  • Docstrings and type hints are added to new and updated routines, as appropriate
  • All relevant documentation has been updated or added (e.g. README, CONTRIBUTING docs)
  • For each public change and fix in pace-util, HISTORY has been updated
  • Unit tests are added or updated for non-stencil code changes

@jdahm jdahm mentioned this pull request Nov 9, 2022
data = allocator(shape, dtype=dtype)
return Quantity(data, dims=dims, units=units, origin=origin, extent=extent)

def get_quantity_halo_spec(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we cache this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, but it's only called on init, and would need a bit of extra logic because you can't LRU cache on a list (not hashable).

self.update_geopotential_height_on_c_grid(
self._zs, self._ut, self._vt, self._gz, self._ws3, dt2
)
# TODO (floriand): Due to DaCe VRAM pooling creating a memory
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is solved, right? The fields are no longer used

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.cgrid_shallow_water_lagrangian_dynamics.ptc and self.cgrid_shallow_water_lagrangian_dynamics.delpc are used directly below. They used to be attached to this object instead of c_sw.

@mcgibbon mcgibbon merged commit f5a4848 into main Nov 10, 2022
@mcgibbon mcgibbon deleted the feature/physics_uses_quantity branch November 10, 2022 17:48
twicki pushed a commit that referenced this pull request Nov 15, 2022
jdahm added a commit that referenced this pull request Nov 21, 2022
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.

4 participants