Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API changes: Field and FieldSet #1709

Merged
merged 18 commits into from
Sep 25, 2024
Merged

API changes: Field and FieldSet #1709

merged 18 commits into from
Sep 25, 2024

Conversation

VeckoTheGecko
Copy link
Contributor

@VeckoTheGecko VeckoTheGecko commented Sep 18, 2024

Contributes to #1695

This PR makes many of the names in Field and FieldSet:

  • private - in the case where users are not expected to use them (attributes and methods), and
  • read only where edits to said variables would provide unexpected behaviour/side effects (attributes)

All privatisations are done in a non-breaking way, raising a deprecation warning. I have also updated conftest.py such that any deprecation warnings raised by Parcels result in a failure (meaning we don't accidentally call deprecated methods internally)

There is some testing of these API changes (checking that calls to old attributes names return the privatised attribute, checking of the source code so that old calls now direct to the private versions). Methods aren't actually called as that would require designing test cases for each item.

The method/attributes affected are:

class name action
Field data read_only
Field grid read_only
Field lon read_only
Field lat read_only
Field depth read_only
Field gridindexingtype read_only
Field cast_data_dtype read_only
Field dimensions read_only
Field dataFiles make_private
Field netcdf_engine read_only
Field loaded_time_indices make_private
Field creation_log make_private
Field data_chunks make_private
Field c_data_chunks make_private
Field chunk_set make_private
Field cell_edge_sizes read_only
Field get_dim_filenames() make_private
Field collect_timeslices() make_private
Field reshape() make_private
Field calc_cell_edge_sizes() make_private
Field search_indices_vertical_z() make_private
Field search_indices_vertical_s() make_private
Field reconnect_bnd_indices() make_private
Field search_indices_rectilinear() make_private
Field search_indices_curvilinear() make_private
Field search_indices() make_private
Field interpolator2D() make_private
Field interpolator3D() make_private
Field spatial_interpolation() make_private
Field time_index() make_private
Field ccode_eval() make_private
Field ccode_convert() make_private
Field get_block_id() make_private
Field get_block() make_private
Field chunk_setup() make_private
Field chunk_data() make_private
Field rescale_and_set_minmax() make_private
Field data_concatenate() make_private
FieldSet completed make_private
FieldSet particlefile read_only
FieldSet add_UVfield() make_private
FieldSet check_complete() make_private
FieldSet parse_wildcards() make_private

Other changes:

  • simple error checking for user provided inputs

@VeckoTheGecko VeckoTheGecko changed the title [WIPAPI changes [WIP] API changes Sep 18, 2024
- data
- grid
- lon
- lat
- depth
- interp_method
- gridindexingtype
- cast_data_dtype
- cell_edge_sizes
- get_dim_filenames()
- collect_timeslices()
- calc_cell_edge_sizes()
- search_indices_vertical_z()
- search_indices_vertical_s()
- reconnect_bnd_indices()
- search_indices_rectilinear()
- search_indices_curvilinear()
- search_indices()
- interpolator2D()
- interpolator3D()
- ccode_eval()
- ccode_convert()
- get_block_id()
- get_block()
- chunk_setup()
- chunk_data()
- rescale_and_set_minmax()
- data_concatenate()
- spatial_interpolation()
- Field.dataFiles
- Field.loaded_time_indices
- Field.creation_log
- Field.data_chunks
- Field.c_data_chunks
- Field.chunk_set
- Field.reshape()
- FieldSet.completed
- Field.time_index()
- FieldSet.check_complete()
Make FieldSet.add_UVfield() private and Field.dimensions read only
@VeckoTheGecko VeckoTheGecko changed the title [WIP] API changes API changes: Field and FieldSet Sep 23, 2024
@VeckoTheGecko VeckoTheGecko marked this pull request as ready for review September 23, 2024 09:32
parcels/tools/_helpers.py Outdated Show resolved Hide resolved
tests/test_typing.py Outdated Show resolved Hide resolved
tests/test_deprecations.py Outdated Show resolved Hide resolved
@VeckoTheGecko VeckoTheGecko enabled auto-merge (squash) September 25, 2024 08:27
@VeckoTheGecko VeckoTheGecko merged commit 018be97 into master Sep 25, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants