Merged
Conversation
Member
|
We should support passing only one file path with multiple variables: thats
the most common use case
…On Thu, Sep 5, 2024, 10:58 AM Julia Sloan ***@***.***> wrote:
Purpose
closes #41 <#41>
To-do
- DataHandler: add field to store Dict mapping input varnames to
FileReaders (maintain one file_reader for composed data variable)
- DataHandler: add field to store list of input varnames
- DataHandler: add field to store composing function
- DH constructor: assert number of file paths supplied == number of
varnames
- DH constructor: assert compose function is provided when multiple
input vars provided
- DH constructor: apply compose function to input vars, create data var
- SVI/TVI constructors: add fields for multiple file paths, multiple
varnames, composing function (optional)
Tests
- DH constructor: num file_paths != num varnames (should fail)
- DH constructor: multiple input vars, no compose func (should fail)
- DH constructor: 1 input var, compose func (should fail, or warn that
using identity)
- DH constructor: 1 input var, no compose func (should pass)
- DH constructor: multiple input vars, compose func (should pass)
- SVI constructors with + without varnames
- TVI constructors with + without varnames
Content
------------------------------
- I have read and checked the items on the review checklist.
------------------------------
You can view, comment on, or merge this pull request online at:
#105
Commit Summary
- 03ef58f
<03ef58f>
DH, SVI some changes
File Changes
(2 files <https://github.com/CliMA/ClimaUtilities.jl/pull/105/files>)
- *M* ext/DataHandlingExt.jl
<https://github.com/CliMA/ClimaUtilities.jl/pull/105/files#diff-95c9e30bd3fcf6388f3a6346ff337b9305fece08bbe9343199f832843b4bd2f2>
(140)
- *M* ext/SpaceVaryingInputsExt.jl
<https://github.com/CliMA/ClimaUtilities.jl/pull/105/files#diff-c6f8c06af2248d2e1fd39f9a5690f588700eb35db050f5079976f960df9811cc>
(9)
Patch Links:
- https://github.com/CliMA/ClimaUtilities.jl/pull/105.patch
- https://github.com/CliMA/ClimaUtilities.jl/pull/105.diff
—
Reply to this email directly, view it on GitHub
<#105>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACF6E7MU3RW2O2GU5QSCHXDZVCLTJAVCNFSM6AAAAABNXAKHXSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGUYDQNBQHE4TOMA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Member
Author
Okay, I'll change it to support that. Do we also want to support passing multiple file paths for multiple variables? I think this would become complicated quickly because there may not be a one-to-one mapping, i.e. in the case |
Member
|
We can just do:
We can add more if need arises. |
92c66fe to
ab5bd13
Compare
Sbozzolo
reviewed
Sep 6, 2024
Sbozzolo
reviewed
Sep 6, 2024
Sbozzolo
reviewed
Sep 6, 2024
Sbozzolo
reviewed
Sep 6, 2024
Sbozzolo
reviewed
Sep 6, 2024
Sbozzolo
reviewed
Sep 6, 2024
Sbozzolo
reviewed
Sep 6, 2024
Sbozzolo
reviewed
Sep 6, 2024
cf098c2 to
d39a234
Compare
Sbozzolo
approved these changes
Sep 8, 2024
Member
Sbozzolo
left a comment
There was a problem hiding this comment.
Thank you!
I left some small comments and a couple of suggestions for cleaner code.
This PR adds functionality to `DataHandler`, `TimeVaryingInputs`, and `SpaceVaryingInputs` to enable composing multiple input variables into one data variable. To do this, the user must specify a composing function, multiple variable names, and the file paths where they can be read from. Most of the changes have been made at the `DataHandler` level. Each input variable has its own unique `FileReader` object, and each composed data variable has one `Time/SpaceVaryingInput` and one `DataHandler`. The composing function itself is applied in the `regridded_snapshot` function, just before regridding. The user will interact with this feature at the `Time/SpaceVaryingInput` level. This feature is only available when using `InterpolationsRegridder`, not `TempestRegridder`. Design decisions made include: - If a pre-processing function is provided, it is applied to each input variable before they are composed. - Variables are composed before regridding, to preserve higher resolution information - We assume that all input variables have the same temporal and spatial dimensions. This is explicitly checked in the `DataHandler` constructor, and will raise an informative error message if it is not true. - Multiple input variables can come from one file, or each from their own unique file. We don't currently support arbitrary numbers of input variables and files, since this would require more work to implement and is not an expected use case in the near term.
d39a234 to
f425172
Compare
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
closes #41
This PR adds functionality to
DataHandler,TimeVaryingInputs, andSpaceVaryingInputsto enable composing multiple input variables into one data variable. To do this, the user must specify a composing function, multiple variable names, and the file paths where they can be read from.Most of the changes have been made at the
DataHandlerlevel. Each input variable has its own uniqueFileReaderobject, and each composed data variable has oneTime/SpaceVaryingInputand oneDataHandler. The composing function itself is applied in theregridded_snapshotfunction, just before regridding. The user will interact with this feature at theTime/SpaceVaryingInputlevel.This feature is only available when using
InterpolationsRegridder, notTempestRegridder.Design decisions made include:
DataHandlerconstructor, and will raise an informative error message if it is not true.To-do
Tests
Content