- 
                Notifications
    
You must be signed in to change notification settings  - Fork 22
 
          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?
Changes from all commits
bad6fb1
              fb34727
              dee9a17
              a8df621
              59d3004
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| 
          
            
          
           | 
    @@ -22,7 +22,8 @@ import ClimaOcean.DataWrangling: | |||
| metadata_filename, | ||||
| inpainted_metadata_path, | ||||
| reversed_vertical_axis, | ||||
| available_variables | ||||
| available_variables, | ||||
| is_three_dimensional | ||||
| 
     | 
||||
| using Scratch | ||||
| 
     | 
||||
| 
          
            
          
           | 
    @@ -129,20 +130,31 @@ end | |||
| 
     | 
||||
| inpainted_metadata_path(metadata::CopernicusMetadata) = joinpath(metadata.dir, inpainted_metadata_filename(metadata)) | ||||
| 
     | 
||||
| location(::CopernicusMetadata) = (Center, Center, Center) | ||||
| location(metadata::CopernicusMetadata) = is_three_dimensional(metadata) ? (Center, Center, Center) : (Center, Center, Nothing) | ||||
| longitude_interfaces(::CopernicusMetadata) = (0, 360) | ||||
| latitude_interfaces(::CopernicusMetadata) = (-80, 90) | ||||
| 
     | 
||||
| is_three_dimensional(metadata::CopernicusMetadata) = | ||||
| metadata.name == :temperature || | ||||
| metadata.name == :salinity || | ||||
| metadata.name == :u_velocity || | ||||
| metadata.name == :v_velocity | ||||
| 
     | 
||||
| function z_interfaces(metadata::CopernicusMetadata) | ||||
| path = metadata_path(metadata) | ||||
| ds = Dataset(path) | ||||
| zc = - reverse(ds["depth"][:]) | ||||
| close(ds) | ||||
| dz = zc[2] - zc[1] | ||||
| zf = zc[1:end-1] .+ zc[2:end] | ||||
| push!(zf, 0) | ||||
| pushfirst!(zf, zf[1] - dz) | ||||
| return zf | ||||
| # Check if this is a 2D surface variable | ||||
| if !is_three_dimensional(metadata) | ||||
| return (0, 1) | ||||
| 
         
      Comment on lines
    
      +145
     to 
      +146
    
   
  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be better to build a  There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this line seems to want to take something for  
 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, the size and the halo must be 2-tuples to use   | 
||||
| else | ||||
| path = metadata_path(metadata) | ||||
| ds = Dataset(path) | ||||
| zc = - reverse(ds["depth"][:]) | ||||
| close(ds) | ||||
| dz = zc[2] - zc[1] | ||||
| zf = zc[1:end-1] .+ zc[2:end] | ||||
| push!(zf, 0) | ||||
| pushfirst!(zf, zf[1] - dz) | ||||
| return zf | ||||
| end | ||||
| end | ||||
| 
     | 
||||
| end # module Copernicus | ||||
| end # module Copernicus | ||||
Uh oh!
There was an error while loading. Please reload this page.
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:
ClimaOcean.jl/src/DataWrangling/metadata_field.jl
Line 53 in dac9760
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 becauseis_three_dimensional == !is_two_dimensionalThere 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: