From 5dbd875446c5fdf71d12de86ebb5f1f698f6c952 Mon Sep 17 00:00:00 2001 From: saraqzhang Date: Mon, 27 Feb 2023 22:23:42 -0500 Subject: [PATCH 1/5] heterogenous standard deviation for perturbation, input from nc file --- .../LDAS_PertRoutines.F90 | 30 +++++++++++-------- .../Shared/LDAS_TileCoordRoutines.F90 | 2 +- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/Components/GEOSldas_GridComp/GEOSlandpert_GridComp/LDAS_PertRoutines.F90 b/src/Components/GEOSldas_GridComp/GEOSlandpert_GridComp/LDAS_PertRoutines.F90 index b32b6e40..03c7eb37 100644 --- a/src/Components/GEOSldas_GridComp/GEOSlandpert_GridComp/LDAS_PertRoutines.F90 +++ b/src/Components/GEOSldas_GridComp/GEOSlandpert_GridComp/LDAS_PertRoutines.F90 @@ -658,7 +658,9 @@ subroutine get_pert_grid( tile_grid, pert_grid ) else ! cubed-sphere grid !for cubed-sphere grid, global lat_lon grid N_x=tile_grid%n_lon - + ! NOTE: the grid specification is hard-wired here, + ! if perturbation sdv is heterogeous input from a file + ! the input grid must match this grid (sqz 2/2023) n_lon=4*N_x n_lat=3*N_x write(lattmp,'(I6.6)') n_lat @@ -1111,6 +1113,8 @@ subroutine get_force_pert_inputs( pert_grid_l, & call MPI_BCAST(stdfilename_force_pert,300,MPI_CHARACTER,0,mpicomm,mpierr) nc4_file = stdfilename_force_pert + ! NOTE: the input file is in netcdf, with a group 'std_force_pert', + ! and the grid is same as *global* grid (tile_grid_g) (sqz 2/2023) ! --compute-local-shape-first- ! ASSUMPTION: data in file are on the *global* grid (tile_grid_g) @@ -1150,11 +1154,11 @@ subroutine get_force_pert_inputs( pert_grid_l, & ) if (nc4_stat /= nf90_noerr) call handle_nc4_stat(nc4_stat) ! get _FillValue for nc4_varname - nc4_stat = nf90_get_att(nc4_grpid, nc4_varid, '_FillValue', nc4_fillval) - if (nc4_stat /= nf90_noerr) call handle_nc4_stat(nc4_stat) + !nc4_stat = nf90_get_att(nc4_grpid, nc4_varid, '_FillValue', nc4_fillval) + !if (nc4_stat /= nf90_noerr) call handle_nc4_stat(nc4_stat) ! replace _FillValue by zero - where (abs(std_force_pert(ivar,:,:)-nc4_fillval) Date: Thu, 2 Mar 2023 16:04:29 -0500 Subject: [PATCH 2/5] remove "comment!" on reading fillvalue from sdv nc file --- .../GEOSlandpert_GridComp/LDAS_PertRoutines.F90 | 16 ++++++++-------- .../Shared/LDAS_TileCoordRoutines.F90 | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Components/GEOSldas_GridComp/GEOSlandpert_GridComp/LDAS_PertRoutines.F90 b/src/Components/GEOSldas_GridComp/GEOSlandpert_GridComp/LDAS_PertRoutines.F90 index 03c7eb37..b36dd732 100644 --- a/src/Components/GEOSldas_GridComp/GEOSlandpert_GridComp/LDAS_PertRoutines.F90 +++ b/src/Components/GEOSldas_GridComp/GEOSlandpert_GridComp/LDAS_PertRoutines.F90 @@ -1154,11 +1154,11 @@ subroutine get_force_pert_inputs( pert_grid_l, & ) if (nc4_stat /= nf90_noerr) call handle_nc4_stat(nc4_stat) ! get _FillValue for nc4_varname - !nc4_stat = nf90_get_att(nc4_grpid, nc4_varid, '_FillValue', nc4_fillval) - !if (nc4_stat /= nf90_noerr) call handle_nc4_stat(nc4_stat) + nc4_stat = nf90_get_att(nc4_grpid, nc4_varid, '_FillValue', nc4_fillval) + if (nc4_stat /= nf90_noerr) call handle_nc4_stat(nc4_stat) ! replace _FillValue by zero - !where (abs(std_force_pert(ivar,:,:)-nc4_fillval) Date: Tue, 7 Mar 2023 16:45:41 -0500 Subject: [PATCH 3/5] restoring develop version of LDAS_TileCoordRoutines.F90 to avoid unnecessary whitespace changes --- .../GEOSldas_GridComp/Shared/LDAS_TileCoordRoutines.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Components/GEOSldas_GridComp/Shared/LDAS_TileCoordRoutines.F90 b/src/Components/GEOSldas_GridComp/Shared/LDAS_TileCoordRoutines.F90 index ee1bf958..a059ed1b 100644 --- a/src/Components/GEOSldas_GridComp/Shared/LDAS_TileCoordRoutines.F90 +++ b/src/Components/GEOSldas_GridComp/Shared/LDAS_TileCoordRoutines.F90 @@ -427,7 +427,7 @@ subroutine LDAS_create_grid_g( gridname, n_lon, n_lat, & if (date_line_on_center) then - tile_grid%ll_lon = -180. - tile_grid%dlon/2. + tile_grid%ll_lon = -180. - tile_grid%dlon/2. tile_grid%ur_lon = 180. - tile_grid%dlon/2. ! fixed 20 sep 2010, reichle else From ab6111d0b24fc3708b35cda1dab6eebf472713ba Mon Sep 17 00:00:00 2001 From: Rolf Reichle Date: Tue, 7 Mar 2023 16:59:05 -0500 Subject: [PATCH 4/5] minimal edits of comments in LDAS_PertRoutines.F90 --- .../GEOSlandpert_GridComp/LDAS_PertRoutines.F90 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Components/GEOSldas_GridComp/GEOSlandpert_GridComp/LDAS_PertRoutines.F90 b/src/Components/GEOSldas_GridComp/GEOSlandpert_GridComp/LDAS_PertRoutines.F90 index b36dd732..4c11284d 100644 --- a/src/Components/GEOSldas_GridComp/GEOSlandpert_GridComp/LDAS_PertRoutines.F90 +++ b/src/Components/GEOSldas_GridComp/GEOSlandpert_GridComp/LDAS_PertRoutines.F90 @@ -658,9 +658,9 @@ subroutine get_pert_grid( tile_grid, pert_grid ) else ! cubed-sphere grid !for cubed-sphere grid, global lat_lon grid N_x=tile_grid%n_lon - ! NOTE: the grid specification is hard-wired here, - ! if perturbation sdv is heterogeous input from a file - ! the input grid must match this grid (sqz 2/2023) + ! NOTE: The pert grid specification is hard-wired here. + ! If perturbation stddev is heterogeneous input from a file, + ! then the input grid must match this hard-wired grid. (sqz 2/2023) n_lon=4*N_x n_lat=3*N_x write(lattmp,'(I6.6)') n_lat @@ -1114,7 +1114,7 @@ subroutine get_force_pert_inputs( pert_grid_l, & nc4_file = stdfilename_force_pert ! NOTE: the input file is in netcdf, with a group 'std_force_pert', - ! and the grid is same as *global* grid (tile_grid_g) (sqz 2/2023) + ! and the grid is same as the *global* grid (tile_grid_g) (sqz 2/2023) ! --compute-local-shape-first- ! ASSUMPTION: data in file are on the *global* grid (tile_grid_g) @@ -1158,7 +1158,7 @@ subroutine get_force_pert_inputs( pert_grid_l, & if (nc4_stat /= nf90_noerr) call handle_nc4_stat(nc4_stat) ! replace _FillValue by zero where (abs(std_force_pert(ivar,:,:)-nc4_fillval) Date: Wed, 8 Mar 2023 15:12:12 -0500 Subject: [PATCH 5/5] updated comments in LDAS_PertRoutines.F90 --- .../LDAS_PertRoutines.F90 | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/Components/GEOSldas_GridComp/GEOSlandpert_GridComp/LDAS_PertRoutines.F90 b/src/Components/GEOSldas_GridComp/GEOSlandpert_GridComp/LDAS_PertRoutines.F90 index 4c11284d..d2c6e846 100644 --- a/src/Components/GEOSldas_GridComp/GEOSlandpert_GridComp/LDAS_PertRoutines.F90 +++ b/src/Components/GEOSldas_GridComp/GEOSlandpert_GridComp/LDAS_PertRoutines.F90 @@ -651,16 +651,26 @@ subroutine get_pert_grid( tile_grid, pert_grid ) ! perturbations in tile space from gridded perturbations fields ! (see calls to "grid2tile" in clsm_ensdrv_pert_routines.F90, ! clsm_ensupd_upd_routines.F90, and clsm_adapt_routines.F90) + if(index(tile_grid%gridtype,"c3") ==0) then + ! If *not* cube-sphere tile space, then for perturbations use the grid that + ! defines the tile space (a.k.a. "tile_grid"). E.g., if in EASE grid tile space, + ! the pert grid is the EASE grid. + pert_grid = tile_grid else ! cubed-sphere grid - !for cubed-sphere grid, global lat_lon grid + + ! For cubed-sphere tile space, use a global lat_lon pert grid with a resolution + ! similar to that of the grid that defines the tile space. + N_x=tile_grid%n_lon + ! NOTE: The pert grid specification is hard-wired here. ! If perturbation stddev is heterogeneous input from a file, ! then the input grid must match this hard-wired grid. (sqz 2/2023) + n_lon=4*N_x n_lat=3*N_x write(lattmp,'(I6.6)') n_lat @@ -1113,11 +1123,13 @@ subroutine get_force_pert_inputs( pert_grid_l, & call MPI_BCAST(stdfilename_force_pert,300,MPI_CHARACTER,0,mpicomm,mpierr) nc4_file = stdfilename_force_pert - ! NOTE: the input file is in netcdf, with a group 'std_force_pert', - ! and the grid is same as the *global* grid (tile_grid_g) (sqz 2/2023) - + + ! NOTE: the input file is in netcdf format, with a group 'std_force_pert', + ! and the grid in the netcdf file must be the *global* pert grid + ! (see subroutine get_pert_grid()) + ! --compute-local-shape-first- - ! ASSUMPTION: data in file are on the *global* grid (tile_grid_g) + ! ASSUMPTION: data in file are on the *global* pert grid xstart = pert_grid_l%i_offg + 1 xcount = pert_grid_l%N_lon ystart = pert_grid_l%j_offg + 1 @@ -1507,11 +1519,13 @@ subroutine get_progn_pert_inputs( pert_grid_l, & call MPI_BCAST(stdfilename_progn_pert,300,MPI_CHARACTER,0,mpicomm,mpierr) nc4_file = stdfilename_progn_pert - ! NOTE: the input file is in netcdf, with a group 'std_progn_pert', - ! and the grid is same as the *global* grid (tile_grid_g) (sqz 2/2023) + + ! NOTE: the input file is in netcdf format, with a group 'std_force_pert', + ! and the grid in the netcdf file must be the *global* pert grid + ! (see subroutine get_pert_grid()) ! --compute-local-shape-first- - ! ASSUMPTION: data in file are on the *global* grid (tile_grid_g) + ! ASSUMPTION: data in file are on the *global* pert grid xstart = pert_grid_l%i_offg + 1 xcount = pert_grid_l%N_lon ystart = pert_grid_l%j_offg + 1