Skip to content

Issue 2644: Rename constants to context#2672

Open
PeterWolfram wants to merge 13 commits into
Parcels-code:mainfrom
PeterWolfram:rename_constant_context
Open

Issue 2644: Rename constants to context#2672
PeterWolfram wants to merge 13 commits into
Parcels-code:mainfrom
PeterWolfram:rename_constant_context

Conversation

@PeterWolfram

Copy link
Copy Markdown
Contributor

As described in issue #2644

  1. renamed FieldSet.add_constant -> FieldSet.add_context
  2. renamed FieldSet.constants -> FieldSet.context
  3. added setattr to raise an error if trying to attribute access a variable in FieldSet.context to prevent silent unexpected behavior

Additionally deleted empty "_core/constants.py" file

@PeterWolfram PeterWolfram changed the title Issue https://github.com/Parcels-code/Parcels/issues/2644: Rename constants to context Issue 2644: Rename constants to context Jun 16, 2026

@erikvansebille erikvansebille left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good; just a few small comments below!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is a v3 file; so shouldn't be changed. Can you revert this change? The same is true for the other files in docs/user_guide/examples_v3

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

git tip for Peter: you can quickly revert by doing git checkout main -- docs/user_guid/examples_v3. After the -- specifies files, which is basically like "copy the files from the main branch"

Comment thread src/parcels/_core/constants.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

what changed here? Whitespace only?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Removed file :)

Comment thread tests-v3/test_fieldset.py

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is an old file from tests-v3; these don't need to be changed

@VeckoTheGecko

Copy link
Copy Markdown
Contributor

Also, small note - would you mind following our PR template? It nice to keep things consistent, and also the Closes #xxx syntax means that the upstream issue gets auto-closed when this is merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants