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

Adds methods to mask_immersed_field! for BinaryOperations #3683

Merged
merged 11 commits into from
Aug 15, 2024

Conversation

jagoosw
Copy link
Collaborator

@jagoosw jagoosw commented Aug 6, 2024

As discussed in #3676, this PR attempts to add methods to mask_immersed_field! for BinaryOperations so they can be passed as auxiliary fields.

This works for binary operations which combine fields or a field and a number. To make + and - work I have to set the value to -/+ the number value for the field.

mask_immersed

Copy link
Member

@glwagner glwagner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done.

@jagoosw
Copy link
Collaborator Author

jagoosw commented Aug 7, 2024

I think the only place this will fail is for number ^ field since we can never make this zero. We could do:

b_value = ifelse(a < 0, Inf, -Inf)

but this also fails in the case of a==1, although that would be a bit of a strange operation to have written?

@glwagner
Copy link
Member

glwagner commented Aug 9, 2024

Is it actually important to support the operation ^?

@glwagner
Copy link
Member

glwagner commented Aug 9, 2024

You don't need to use ifelse here by the way, if is ok. This is not inside a kernel.

@glwagner
Copy link
Member

glwagner commented Aug 9, 2024

Note that the masking operation is really supposed to set the field to some prescribed value. Not always "0". So it's going to be challenge to cover all cases it would seem.

Do we have to support operations that involve numbers and fields? We could just support fields with fields. Things are easier.

Also there is a problem if a field appears "on its own", and also in a binary operation. Then one masking operation could cancel the other for operations like / and ^. Seems like a bit of a rabbit hole. We could just support + and - and call it good.

@jagoosw
Copy link
Collaborator Author

jagoosw commented Aug 13, 2024

I think it would be a lot more straight forward to support just + and - and we can guarantee the value is correct then too

@glwagner
Copy link
Member

I think it would be a lot more straight forward to support just + and - and we can guarantee the value is correct then too

Ok, let's do that

@jagoosw jagoosw merged commit e85452b into main Aug 15, 2024
46 checks passed
jagoosw added a commit that referenced this pull request Aug 22, 2024
Patch release including bug fix for biogeochemistry fallbacks (#3685), `mask_immersed_field!` method for `BinaryOperations` (#3683), restricting lat/lon grid topologies (#3694), and more Makie recipe components (#3715).
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.

2 participants