-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add partial resampling #202
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #202 +/- ##
==========================================
+ Coverage 98.25% 98.32% +0.06%
==========================================
Files 12 12
Lines 1263 1313 +50
==========================================
+ Hits 1241 1291 +50
Misses 22 22 ☔ View full report in Codecov by Sentry. |
4d83c41
to
7d400f3
Compare
If the string or iterable `dim_names` is nothing, then resampling is done over all | ||
dimensions. Otherwise, resampling is done over the dimensions in `dim_names`. If | ||
resampling is done over all dimensions, then reordering dimensions is | ||
automatically done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What names are used for the dimensions?
Are the actual names or the conventional names?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's also add a !!! compat
note to specify which version introduced this feature
to fit the dimensions in `dest_var`. Resampling only over selected dimensions is | ||
possible with the keyword `dim_names`. Resampling is not possible when the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's add an entry in the FAQ about this
src/outvar_dimensions.jl
Outdated
""" | ||
find_corresponding_dim_name(dim_name::AbstractString, dim_names::Iterable) | ||
|
||
Find the corresponding dimension name in `dim_names` that match `dim_name`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clarify that this is using the internal name bindings / going through the conventioanl names?
x_long = 0.0:180.0 |> collect | ||
x_lat = 0.0:90.0 |> collect | ||
x_data = reshape(1.0:(181 * 91), (91, 181)) | ||
x_dims = OrderedDict(["lat" => x_lat, "long" => x_long]) | ||
x_attribs = Dict("long_name" => "hi") | ||
x_dim_attribs = OrderedDict([ | ||
"lat" => Dict("units" => "test_units2"), | ||
"long" => Dict("units" => "test_units1"), | ||
]) | ||
x_var = ClimaAnalysis.OutputVar(x_attribs, x_dims, x_dim_attribs, x_data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not related to this PR, but we might want to think about adding a Factory or something to create OutputVar and reduce all this boilerplate
The keyword argument `dim_names` allows the caller to only check for a certain dimension as opposed to all of the dimensions in `x` and `y`.
7d400f3
to
0e63f61
Compare
This PR adds partial resampling by adding the keyword argument
dim_names
toVar.resampled_as
.We also add
Var.find_corresponding_dim_name
which allows one to find the name of the dimension in aOutputVar
by using another dimension name.