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

Define and test behaviour of get_data #114

Merged
merged 1 commit into from
Jan 5, 2025
Merged

Define and test behaviour of get_data #114

merged 1 commit into from
Jan 5, 2025

Conversation

sjdaines
Copy link
Member

@sjdaines sjdaines commented Jan 5, 2025

Change in behaviour (really a bugfix) for get_data for a CellSpace variable in a Domain with one cell: now returns a Vector ie spatial dimension is squeezed out (previously, returned a Vector-of-length-1-Vectors)

PB.get_data(fr::FieldRecord; records=nothing, squeeze_all_single_dims=true)

Get data records in raw format. Only recommended for variables with scalar data ie one value per record.

records may be nothing to get all records,
an Int to select a single record, or a range to select multiple records.

If squeeze_all_single_dims=true (the default), if each record represents a scalar (eg a PALEO Variable with Space PB.ScalarSpace, or a PB.CellSpace variable in a Domain with a single cell), then data is returned as a Vector. NB: if records is an Int, the single record requested is returned as a length-1 Vector.

Non-scalar data (eg a non-ScalarSpace variable from a Domain with > 1 cell) is returned in internal format as a Vector-of-Vectors.

Change in behaviour (really a bugfix) for get_data for a CellSpace variable
in a Domain with one cell: now returns a Vector ie spatial dimension is squeezed out
(previously, returned a Vector-of-length 1 Vectors)

    PB.get_data(fr::FieldRecord; records=nothing, squeeze_all_single_dims=true)

Get data records in raw format. Only recommended for variables with scalar data ie one value per record.

`records` may be `nothing` to get all records,
an `Int` to select a single record, or a range to select multiple records.

If `squeeze_all_single_dims=true` (the default), if each record represents a scalar
(eg a PALEO Variable with Space PB.ScalarSpace, or a PB.CellSpace variable in a Domain with
a single cell), then data is returned as a Julia Vector. NB: if `records` is an Int,
the single record requested is returned as a length-1 Vector.

Non-scalar data (eg a non-ScalarSpace variable from a Domain with > 1 cell)
is returned in internal format as a Vector-of-Vectors.
@sjdaines sjdaines merged commit 75ccea0 into main Jan 5, 2025
1 of 3 checks passed
@sjdaines sjdaines deleted the get_data_fix branch January 5, 2025 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant