Skip to content

Field selection: use select_by_* methods instead of indexing #119

Description

@sadielbartholomew

The docs examples always select the relevant fields from the read-in Field List using indexing, but this is less explicit and more brittle than selection using one of cf-python's dedicated select_by_ methods, so we should replace any cases where the Field List is non-singular with filtering by selection method.

I suggest that we still use indexing for those singular Field Lists to highlight that indexing is an alternative possibility which represents the simplest way to extract the field when it's the only one there, but otherwise always use some select_by_* method.

Activity

  1. changed the title [-]Replace use of field selection by index with `select_by_*` methods[/-] [+]Replace use of field selection by index w/ `select_by_*` methods[/+] on Dec 12, 2025
  2. changed the title [-]Replace use of field selection by index w/ `select_by_*` methods[/-] [+]Field selection: use `select_by_*` methods instead of indexing[/+] on Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions