Skip to content

Create a grid.negate_depth method to swap the sign of depth fields? #1746

@erikvansebille

Description

@erikvansebille

Since the sign/orientation of the depth vector is not standardised in oceanography, users may sometimes need to negate a grid.depth field. See e.g. Parcels-code/virtualship#75. Especially since grid._depth is a private attribute, this is not trivial to users.

It might thus be useful to add a simple grid.negate_depth()method that simply does

def negate_depth(self):
    self._depth = -self._depth

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions