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

MOM6 static file mask missing values #727

Merged
merged 7 commits into from
Sep 27, 2024
Merged

Conversation

hkershaw-brown
Copy link
Member

@hkershaw-brown hkershaw-brown commented Aug 30, 2024

Description:

CESM3 MOM6 TL319_t232 (new workhorse grid) has missing/fill values in the static file for geolat|lon|u|v written out by CESM.

This pull request:

  • checks for fillvalue in the grid and uses the fillvalue locations as the mask to pass to quad_utils_mod.
  • The grid == fillvalues are also set to a dry land lat,lon. This is to stop set_location blowing up with lon = 1e+20.
    Note the missing value locations are not the same as the ocean_geometry 'wet' mask.
  • Forces lon to be [0-360]

Also I have set the MOM6/work/input.nml cutoff to something not giant. Not sure if 0.03 is appropriate for the ocean.
& set the perfect_model_obs namelist init_time_days to -1 -1.

Fixes issue

fixes #685

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Documentation changes needed?

  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.

Tests

Please describe any tests you ran to verify your changes.

Running cesm3_0_alpha03a
/glade/derecho/scratch/hkershaw/DART/Crocodile/DART_Runs/c.TL319_t232.001
perturbed from a single instance.
CESM:

/glade/derecho/scratch/hkershaw/DART/Crocodile/CESM((cesm3_0_alpha03a))
/glade/derecho/scratch/hkershaw/DART/Crocodile/Runs/c.TL319_t232.001
../CESM/cime/scripts/create_newcase --run-unsupported --res TL319_t232 --compset C_JRA --case c.TL319_t232.001 --project P86850054

Checklist for merging

  • Updated changelog entry
  • Documentation updated
  • Update conf.py

Checklist for release

  • Merge into main
  • Create release from the main branch with appropriate tag
  • Delete feature-branch

Testing Datasets

  • Dataset needed for testing available upon request
  • Dataset download instructions included
  • No dataset needed

fixes #685

force longitudes to be between 0-360.  The missing value 1e20 is
in this calculation.  Not sure whether to put missing value back in
to avoid accidental use.
mask where geolon is the fillvalue.  Note the mask for geolon/lat/u/v
is not the same as 'wet' from the ocean_geometry.nc file.

Setting the masked lat lon values to a land value. This is because
set_location is used on all the lat, lon vaues and 1e20 will blow up
set_location
perfect_model_obs init time as  -1 -1
@hkershaw-brown hkershaw-brown added the mom6 Modular Ocean Model label Aug 30, 2024
@hkershaw-brown
Copy link
Member Author

note added this fix to https://github.com/NCAR/DART/tree/mom6-scripting
which has the mom6 assimilate.sh that Enrico is kicking the tires on.

@hkershaw-brown hkershaw-brown changed the title MOM6 static file mask missing vlaues MOM6 static file mask missing values Sep 25, 2024
Copy link
Contributor

@mjs2369 mjs2369 left a comment

Choose a reason for hiding this comment

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

! mom6 has missing values in the grid
mask(:,:) = .false.
call nc_get_attribute_from_variable(ncid, 'geolon', '_FillValue', fillval)
where (geolon == fillval) mask = .true.

Why don't we need to repeat this process done in the lines above for geolon_u and geolon_v and have a separate mask array for each? These mask arrays, for example, mask_geolon_u would be passed into their respective calls to set_quad_coords. Example:
call set_quad_coords(interp_u_grid, geolon_u, geolat_u, mask_geolon_u)

Is this because the missing values are always going to be in the same place for gelon, geolon_u, and geolon_v? And therefore the mask array would be simply be duplicated for geolon_u and geolon_v?

@hkershaw-brown
Copy link
Member Author

Is this because the missing values are always going to be in the same place for gelon, geolon_u, and geolon_v? And therefore the mask array would be simply be duplicated for geolon_u and geolon_v?

There are in the same place for the case , but you're correct there's no guarantee that that will always be the case. I'll add a mask for each

Cautious approach, since it is possible that the missing value mask may not be at the same place
@mjs2369
Copy link
Contributor

mjs2369 commented Sep 26, 2024

There are in the same place for the case , but you're correct there's no guarantee that that will always be the case. I'll add a mask for each

Should we have a separate array for the fillval as well or is that not needed?
fillval, fillval_u, fillval_v

@hkershaw-brown
Copy link
Member Author

There are in the same place for the case , but you're correct there's no guarantee that that will always be the case. I'll add a mask for each

Should we have a separate array for the fillval as well or is that not needed? fillval, fillval_u, fillval_v

Do you mean move the where (geolon_u == fillval) geolon_u = 72.51 in case the fill values are different for each variable? Yeah probably wise.

call nc_get_attribute_from_variable(ncid, 'geolon_u', '_FillValue', fillval)
where (geolon_u == fillval) mask_u = .true.  
where (geolon_u == fillval) geolon_u = 72.51`

@mjs2369
Copy link
Contributor

mjs2369 commented Sep 26, 2024

Do you mean move the where (geolon_u == fillval) geolon_u = 72.51 in case the fill values are different for each variable? Yeah probably wise.

call nc_get_attribute_from_variable(ncid, 'geolon_u', '_FillValue', fillval)
where (geolon_u == fillval) mask_u = .true.  
where (geolon_u == fillval) geolon_u = 72.51`

Yep that's exactly it

And do where (geolat_u == fillval) geolat_u = 42.56 as well before the next call to nc_get_attribute_from_variable

So the full thing would be

call nc_get_attribute_from_variable(ncid, 'geolon_u', '_FillValue', fillval)
where (geolon_u == fillval) 
  mask_u = .true.  
  geolon_u = 72.51
where (geolat_u == fillval) geolat_u = 42.56

Copy link
Contributor

@mjs2369 mjs2369 left a comment

Choose a reason for hiding this comment

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

Everything looks good. Nice fix Helen

I ended up testing with the case you had in /glade/derecho/scratch/hkershaw/DART/Crocodile/DART_Runs/c.TL319_t232.001

I was getting the error message shown in the corresponding issue when running filter on the main branch, but I was able to run filter successfully on the mom6-missing-grid branch with all the latest commits.

@hkershaw-brown hkershaw-brown added the release! bundle with next release label Sep 27, 2024
@hkershaw-brown hkershaw-brown merged commit 464aa57 into main Sep 27, 2024
4 checks passed
@hkershaw-brown hkershaw-brown deleted the mom6-missing-grid branch October 1, 2024 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mom6 Modular Ocean Model release! bundle with next release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: quad_utils_mod out-of-range negative for MOM6
2 participants