-
Notifications
You must be signed in to change notification settings - Fork 21
Allow the use of CopernicusMetadata
to initialize sea ice
#644
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
base: main
Are you sure you want to change the base?
Conversation
is_three_dimensional(metadata::CopernicusMetadata) = | ||
metadata.name == :temperature || | ||
metadata.name == :salinity || | ||
metadata.name == :u_velocity || | ||
metadata.name == :v_velocity |
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.
I think you should blacklist the 2D variables rather than whitelisting 3D variables, since most variables are 3D
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.
Here I was trying to follow the design pattern here:
if is_three_dimensional(metadata) |
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.
You can achieve this by using a !
conditional because is_three_dimensional == !is_two_dimensional
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.
for example:
is_three_dimensional(metadata::CopernicusMetadata) =
!(metadata.name == :ice_concentration ||
metadata.name == :ice_thickness)
if !is_three_dimensional(metadata) | ||
return (0, 1) |
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.
Would it be better to build a Flat
grid for 2D variables? Why do the z_interfaces
matter?
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.
this line seems to want to take something for z
, I tried returning nothing
but I guess it didn't work
grid = LatitudeLongitudeGrid(arch, FT; halo, longitude, latitude, z, |
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.
yeah, the size and the halo must be 2-tuples to use nothing
in z.
src/DataWrangling/metadata_field.jl
Outdated
halo = (3, 3, 3), | ||
cache_inpainted_data = true) | ||
cache_inpainted_data = true, | ||
fill_nans = nothing) |
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.
why not just use true
or false
here? Also I am confused --- shouldn't this be handled by inpainting? Inpainting is generally the process of removing invalid entries. Usually we inpaint NaNs with fancy propagation method, but just replacing them with a neutral value (like 0) could be implemented as an additional inpainting option.
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.
I suppose you're right, we should do it via inpainting. Currently there is no zero inpainting available, so I suppose the solution is to write a zero inpainting method and then change default_inpainting
so that it deals with CopernicusMetadata
differently? It seems like for ECCO
no inpainting is required for sea ice
function default_inpainting(metadata) |
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.
Yes, the purpose of the default_inpainting
is to allow dispatch on metadata type
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #644 +/- ##
==========================================
- Coverage 23.04% 22.96% -0.08%
==========================================
Files 48 48
Lines 2990 3009 +19
==========================================
+ Hits 689 691 +2
- Misses 2301 2318 +17 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Closes #643