Skip to content

Commit 464aa57

Browse files
Merge pull request #727 from NCAR/mom6-missing-grid
MOM6 static file mask missing values
2 parents 71d70e1 + 3405802 commit 464aa57

File tree

4 files changed

+49
-16
lines changed

4 files changed

+49
-16
lines changed

CHANGELOG.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ individual files.
2222

2323
The changes are now listed with the most recent at the top.
2424

25-
**September 10 2024:: MARBL_column. Tag 11.8.0**
25+
**September 27 2024 :: MOM6 mask bug-fix. Tag 11.8.1**
26+
27+
- Fix for MOM6 CESM3 workhorse 2/3 degree grid TL319_t232 to
28+
mask missing geolon|lat|u|v|t values
29+
30+
**September 10 2024 :: MARBL_column. Tag 11.8.0**
2631

2732
- Interface for MARBL_column for DART:
2833

conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
author = 'Data Assimilation Research Section'
2222

2323
# The full version, including alpha/beta/rc tags
24-
release = '11.8.0'
24+
release = '11.8.1'
2525
root_doc = 'index'
2626

2727
# -- General configuration ---------------------------------------------------

models/MOM6/model_mod.f90

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ module model_mod
3232
nc_begin_define_mode, nc_end_define_mode, &
3333
nc_open_file_readonly, nc_close_file, &
3434
nc_get_variable, nc_get_variable_size, &
35-
NF90_MAX_NAME
35+
NF90_MAX_NAME, nc_get_attribute_from_variable
3636

3737
use quad_utils_mod, only : quad_interp_handle, init_quad_interp, &
3838
set_quad_coords, quad_lon_lat_locate, &
@@ -97,6 +97,7 @@ module model_mod
9797
real(r8), allocatable :: geolon(:,:), geolat(:,:), & ! T
9898
geolon_u(:,:), geolat_u(:,:), & ! U
9999
geolon_v(:,:), geolat_v(:,:) ! V
100+
logical, allocatable :: mask(:,:), mask_u(:,:), mask_v(:,:) ! geolat/lon/u/v has missing values
100101
type(quad_interp_handle) :: interp_t_grid, &
101102
interp_u_grid, &
102103
interp_v_grid
@@ -595,6 +596,7 @@ subroutine read_horizontal_grid()
595596

596597
integer :: ncid
597598
integer :: nxy(2) ! (nx,ny)
599+
real(r8) :: fillval
598600

599601
character(len=*), parameter :: routine = 'read_horizontal_grid'
600602

@@ -606,22 +608,48 @@ subroutine read_horizontal_grid()
606608
allocate(geolon(nx,ny), geolat(nx,ny)) ! T grid
607609
allocate(geolon_u(nx,ny), geolat_u(nx,ny)) ! U grid
608610
allocate(geolon_v(nx,ny), geolat_v(nx,ny)) ! V grid
611+
allocate(mask(nx,ny)) ! missing values
612+
allocate(mask_u(nx,ny)) ! missing values
613+
allocate(mask_v(nx,ny)) ! missing values
609614

610615
call nc_get_variable(ncid, 'geolon', geolon, routine)
611616
call nc_get_variable(ncid, 'geolon_u', geolon_u, routine)
612617
call nc_get_variable(ncid, 'geolon_v', geolon_v, routine)
613618

614-
615-
! mom6 example file has longitude > 360
616-
! DART uses [0,360]
617-
where(geolon > 360.0_r8 ) geolon = geolon - 360.0_r8
618-
where(geolon_u > 360.0_r8 ) geolon_u = geolon_u - 360.0_r8
619-
where(geolon_v > 360.0_r8 ) geolon_v = geolon_v - 360.0_r8
620-
621619
call nc_get_variable(ncid, 'geolat', geolat, routine)
622620
call nc_get_variable(ncid, 'geolat_u', geolat_u, routine)
623621
call nc_get_variable(ncid, 'geolat_v', geolat_v, routine)
624622

623+
! mom6 has missing values in the grid
624+
! and set missing value to a land point to prevent set_location erroring
625+
mask(:,:) = .false.
626+
mask_u(:,:) = .false.
627+
mask_v(:,:) = .false.
628+
call nc_get_attribute_from_variable(ncid, 'geolon', '_FillValue', fillval)
629+
where (geolon == fillval) mask = .true.
630+
where (geolon == fillval) geolon = 72.51
631+
where (geolat == fillval) geolat = 42.56
632+
633+
call nc_get_attribute_from_variable(ncid, 'geolon_u', '_FillValue', fillval)
634+
where (geolon_u == fillval) mask_u = .true.
635+
where (geolon_u == fillval) geolon_u = 72.51
636+
where (geolat_u == fillval) geolat_u = 42.56
637+
638+
call nc_get_attribute_from_variable(ncid, 'geolon_v', '_FillValue', fillval)
639+
where (geolon_v == fillval) mask_v = .true.
640+
where (geolon_v == fillval) geolon_v = 72.51
641+
where (geolat_v == fillval) geolat_v = 42.56
642+
643+
! mom6 example files have longitude > 360 and longitudes < 0
644+
! DART uses [0,360]
645+
geolon = mod(geolon, 360.0)
646+
geolon_u = mod(geolon_u, 360.0)
647+
geolon_v = mod(geolon_v, 360.0)
648+
649+
where (geolon < 0.0) geolon = geolon + 360
650+
where (geolon_u < 0.0) geolon_u = geolon_u + 360
651+
where (geolon_v < 0.0) geolon_v = geolon_v + 360
652+
625653
call nc_close_file(ncid)
626654

627655
end subroutine read_horizontal_grid
@@ -831,15 +859,15 @@ subroutine setup_interpolation()
831859
global=.true., spans_lon_zero=.true., pole_wrap=.true., &
832860
interp_handle=interp_t_grid)
833861

834-
call set_quad_coords(interp_t_grid, geolon, geolat)
862+
call set_quad_coords(interp_t_grid, geolon, geolat, mask)
835863

836864
! U
837865
call init_quad_interp(GRID_QUAD_FULLY_IRREGULAR, nx, ny, &
838866
QUAD_LOCATED_CELL_CENTERS, &
839867
global=.true., spans_lon_zero=.true., pole_wrap=.true., &
840868
interp_handle=interp_u_grid)
841869

842-
call set_quad_coords(interp_u_grid, geolon_u, geolat_u)
870+
call set_quad_coords(interp_u_grid, geolon_u, geolat_u, mask_u)
843871

844872

845873
! V
@@ -848,7 +876,7 @@ subroutine setup_interpolation()
848876
global=.true., spans_lon_zero=.true., pole_wrap=.true., &
849877
interp_handle=interp_v_grid)
850878

851-
call set_quad_coords(interp_v_grid, geolon_v, geolat_v)
879+
call set_quad_coords(interp_v_grid, geolon_v, geolat_v, mask_v)
852880

853881
end subroutine setup_interpolation
854882

models/MOM6/work/input.nml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020

2121
obs_seq_in_file_name = "obs_seq.in",
2222
obs_seq_out_file_name = "obs_seq.out",
23-
init_time_days = 0,
24-
init_time_seconds = 0,
23+
init_time_days = -1,
24+
init_time_seconds = -1,
2525
first_obs_days = -1,
2626
first_obs_seconds = -1,
2727
last_obs_days = -1,
@@ -93,7 +93,7 @@
9393
/
9494

9595
&assim_tools_nml
96-
cutoff = 1000000.0
96+
cutoff = 0.03
9797
sort_obs_inc = .false.,
9898
spread_restoration = .false.,
9999
sampling_error_correction = .false.,

0 commit comments

Comments
 (0)