Skip to content

Rename FieldSet.add_constant to FieldSet.add_context #2644

Description

@VeckoTheGecko

Erik and I discussed this yesterday on a call.
...
We ended up just deciding to update the naming to better reflect v4 of Parcels. We can rename:

  • constants -> context
  • add_constant -> add_context

One difficulty to be aware of is that fieldset.my_constant = 2 does not update the constants/context dict (instead defaulting to Python's built-in behaviour of accepting this since "everything is an object"). I think we should disallow setting values via fieldset.my_constant = 2 in favour of fieldset['my_constant']=2 or fieldset.context['my_constant']=2 (the same way and for the same reasons that Xarray does this).

Closing this and opening a new issue for this renaming.

Originally posted by @VeckoTheGecko in #2337

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions