Skip to content

Commit dd54caa

Browse files
Switch EASE grid handling to new MAPL EASE Grid Factory (#115)
2 parents 1760d39 + 8f62af5 commit dd54caa

File tree

7 files changed

+47
-39
lines changed

7 files changed

+47
-39
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818

1919
### Changed
2020

21+
- Switch to using EASE grid tools in MAPL.
2122
- Specify only ntasks_model for SLURM resource request.
2223
- Revisions for handling of Nens and special nml and mwtrm path/files in coupled land-atm DAS.
2324
- Updated some defaults in LDASsa_DEFAULT_inputs_*.nml files.
2425

2526
### Fixed
2627

27-
- Fixed error from MAPL's ApplicationSupport.F90 to init UDUNITS
28+
- Fixed error from MAPL's ApplicationSupport.F90 to init UDUNITS.
2829

2930
### Removed
3031

GEOS_LdasGridComp.F90

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module GEOS_LdasGridCompMod
77
! !USES
88

99
use ESMF
10-
use MAPL_Mod
10+
use MAPL
1111

1212
use GEOS_MetforceGridCompMod, only: MetforceSetServices => SetServices
1313
use GEOS_LandGridCompMod, only: LandSetServices => SetServices
@@ -16,7 +16,6 @@ module GEOS_LdasGridCompMod
1616
use GEOS_LandAssimGridCompMod, only: LandAssimSetServices => SetServices
1717
use GEOS_LandiceGridCompMod, only: LandiceSetServices => SetServices
1818

19-
use EASE_conv, only: ease_inverse
2019
use LDAS_TileCoordType, only: tile_coord_type , T_TILECOORD_STATE, TILECOORD_WRAP
2120
use LDAS_TileCoordType, only: grid_def_type, io_grid_def_type, operator (==)
2221
use LDAS_TileCoordRoutines, only: get_minExtent_grid, get_ij_ind_from_latlon, io_domain_files
@@ -537,12 +536,12 @@ subroutine Initialize(gc, import, export, clock, rc)
537536
call ESMF_GRID_INTERIOR(agrid,I1,IN,J1,JN)
538537

539538
do I = 1,size(centerX,1)
540-
call ease_inverse(gridname,1.0*(I+I1-2),0.0,lat,lon)
539+
call MAPL_ease_inverse(gridname,1.0*(I+I1-2),0.0,lat,lon)
541540
centerX(I,:) = lon * MAPL_DEGREES_TO_RADIANS
542541
enddo
543542

544543
do J = 1,size(centerY,2)
545-
call ease_inverse(gridname,0.0,1.0*(J+J1-2),lat,lon)
544+
call MAPL_ease_inverse(gridname,0.0,1.0*(J+J1-2),lat,lon)
546545
centerY(:,J) = lat * MAPL_DEGREES_TO_RADIANS
547546
enddo
548547

GEOSlandassim_GridComp/clsm_ensupd_enkf_update.F90

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ module clsm_ensupd_enkf_update
7474
use nr_ran2_gasdev, ONLY: &
7575
NRANDSEED
7676

77-
use ease_conv, ONLY: &
78-
ease_convert
77+
use MAPL, ONLY: &
78+
MAPL_ease_convert
7979

8080
use my_matrix_functions, ONLY: &
8181
row_std
@@ -2235,7 +2235,7 @@ subroutine write_smapL4SMaup( option, date_time, exp_id, N_ens, &
22352235
)
22362236

22372237
if (index(tile_grid_g%gridtype, 'M09') /=0) then
2238-
call ease_convert(trim(tile_grid_g%gridtype), this_lat, this_lon, col_ind, row_ind)
2238+
call MAPL_ease_convert(trim(tile_grid_g%gridtype), this_lat, this_lon, col_ind, row_ind)
22392239
endif
22402240

22412241
! col_ind and row_ind are zero-based, need one-based index here
@@ -2254,7 +2254,7 @@ subroutine write_smapL4SMaup( option, date_time, exp_id, N_ens, &
22542254
)
22552255

22562256
if (index(tile_grid_g%gridtype, 'M09') /=0) then
2257-
call ease_convert(trim(tile_grid_g%gridtype), this_lat, this_lon, col_ind, row_ind)
2257+
call MAPL_ease_convert(trim(tile_grid_g%gridtype), this_lat, this_lon, col_ind, row_ind)
22582258
endif
22592259

22602260
! col_ind and row_ind are zero-based, need one-based index here
@@ -2278,7 +2278,7 @@ subroutine write_smapL4SMaup( option, date_time, exp_id, N_ens, &
22782278
if (index(tile_grid_g%gridtype, 'M09') /=0) then
22792279
! subindex (1:7) to get the string EASEvx_
22802280
gridname_tmp = tile_grid_g%gridtype(1:7)//'M36'
2281-
call ease_convert(gridname_tmp, this_lat, this_lon, col_ind, row_ind)
2281+
call MAPL_ease_convert(gridname_tmp, this_lat, this_lon, col_ind, row_ind)
22822282
endif
22832283

22842284
! col_ind and row_ind are zero-based, need one-based index here

GEOSlandassim_GridComp/clsm_ensupd_read_obs.F90

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ module clsm_ensupd_read_obs
2525
use io_hdf5, ONLY: &
2626
hdf5read
2727

28-
use EASE_conv, ONLY: &
29-
ease_convert, &
30-
ease_extent
28+
use MAPL, ONLY: &
29+
MAPL_ease_convert, &
30+
MAPL_ease_extent
3131

3232
use LDAS_ensdrv_globals, ONLY: &
3333
logit, &
@@ -5542,12 +5542,12 @@ subroutine read_obs_SMOS( date_time, N_catd, this_obs_param, &
55425542

55435543
if (tmp_tile_num(ii)>0) then
55445544

5545-
call ease_convert('EASEv2_M36', &
5545+
call MAPL_ease_convert('EASEv2_M36', &
55465546
tile_coord(tmp_tile_num(ii))%com_lat, &
55475547
tile_coord(tmp_tile_num(ii))%com_lon, &
55485548
M36_col_ind_tile, M36_row_ind_tile )
55495549

5550-
call ease_convert('EASEv2_M36', &
5550+
call MAPL_ease_convert('EASEv2_M36', &
55515551
tmp_lat(ii), &
55525552
tmp_lon(ii), &
55535553
M36_col_ind_obs, M36_row_ind_obs )
@@ -7159,12 +7159,12 @@ subroutine read_obs_SMAP_FT( date_time, N_catd, this_obs_param, &
71597159

71607160
if (tmp_tile_num(ii)>0) then
71617161

7162-
call ease_convert('EASEv2_M09', &
7162+
call MAPL_ease_convert('EASEv2_M09', &
71637163
tile_coord(tmp_tile_num(ii))%com_lat, &
71647164
tile_coord(tmp_tile_num(ii))%com_lon, &
71657165
M09_col_ind_tile, M09_row_ind_tile )
71667166

7167-
call ease_convert('EASEv2_M09', &
7167+
call MAPL_ease_convert('EASEv2_M09', &
71687168
tmp_lat(ii), &
71697169
tmp_lon(ii), &
71707170
M09_col_ind_obs, M09_row_ind_obs )
@@ -8229,12 +8229,12 @@ subroutine read_obs_SMAP_halforbit_Tb( date_time, N_catd, this_obs_param, &
82298229

82308230
if (tmp_tile_num(ii)>0) then
82318231

8232-
call ease_convert('EASEv2_M36', &
8232+
call MAPL_ease_convert('EASEv2_M36', &
82338233
tile_coord(tmp_tile_num(ii))%com_lat, &
82348234
tile_coord(tmp_tile_num(ii))%com_lon, &
82358235
M36_col_ind_tile, M36_row_ind_tile )
82368236

8237-
call ease_convert('EASEv2_M36', &
8237+
call MAPL_ease_convert('EASEv2_M36', &
82388238
tmp_lat(ii), &
82398239
tmp_lon(ii), &
82408240
M36_col_ind_obs, M36_row_ind_obs )
@@ -8529,7 +8529,7 @@ subroutine turn_off_assim_SMAP_L1CTb(N_obs_param, obs_param, N_obsl, Observation
85298529
!
85308530
! assemble 36 km EASEv2 mask of L2AP_Tb obs
85318531

8532-
call ease_extent( 'EASEv2_M36', N_cols, N_rows )
8532+
call MAPL_ease_extent( 'EASEv2_M36', N_cols, N_rows )
85338533

85348534
allocate( mask_h_A(N_cols,N_rows) )
85358535
allocate( mask_h_D(N_cols,N_rows) )
@@ -8551,7 +8551,7 @@ subroutine turn_off_assim_SMAP_L1CTb(N_obs_param, obs_param, N_obsl, Observation
85518551

85528552
if (Observations_f(ii)%species==species_L2AP_Tbh_A) then
85538553

8554-
call ease_convert('EASEv2_M36', Observations_f(ii)%lat, Observations_f(ii)%lon, &
8554+
call MAPL_ease_convert('EASEv2_M36', Observations_f(ii)%lat, Observations_f(ii)%lon, &
85558555
col, row)
85568556

85578557
! set mask=.true. for the M36 grid cell that contains the L2AP_Tb obs;
@@ -8573,7 +8573,7 @@ subroutine turn_off_assim_SMAP_L1CTb(N_obs_param, obs_param, N_obsl, Observation
85738573

85748574
if (Observations_f(ii)%species==species_L2AP_Tbh_D) then
85758575

8576-
call ease_convert('EASEv2_M36', Observations_f(ii)%lat, Observations_f(ii)%lon, &
8576+
call MAPL_ease_convert('EASEv2_M36', Observations_f(ii)%lat, Observations_f(ii)%lon, &
85778577
col, row)
85788578

85798579
! set mask=.true. for the M36 grid cell that contains the L2AP_Tb obs;
@@ -8595,7 +8595,7 @@ subroutine turn_off_assim_SMAP_L1CTb(N_obs_param, obs_param, N_obsl, Observation
85958595

85968596
if (Observations_f(ii)%species==species_L2AP_Tbv_A) then
85978597

8598-
call ease_convert('EASEv2_M36', Observations_f(ii)%lat, Observations_f(ii)%lon, &
8598+
call MAPL_ease_convert('EASEv2_M36', Observations_f(ii)%lat, Observations_f(ii)%lon, &
85998599
col, row)
86008600

86018601
! set mask=.true. for the M36 grid cell that contains the L2AP_Tb obs;
@@ -8617,7 +8617,7 @@ subroutine turn_off_assim_SMAP_L1CTb(N_obs_param, obs_param, N_obsl, Observation
86178617

86188618
if (Observations_f(ii)%species==species_L2AP_Tbv_D) then
86198619

8620-
call ease_convert('EASEv2_M36', Observations_f(ii)%lat, Observations_f(ii)%lon, &
8620+
call MAPL_ease_convert('EASEv2_M36', Observations_f(ii)%lat, Observations_f(ii)%lon, &
86218621
col, row)
86228622

86238623
! set mask=.true. for the M36 grid cell that contains the L2AP_Tb obs;
@@ -8652,7 +8652,7 @@ subroutine turn_off_assim_SMAP_L1CTb(N_obs_param, obs_param, N_obsl, Observation
86528652

86538653
if (Observations_l(ii)%species==species_L1C_Tbh_A) then
86548654

8655-
call ease_convert('EASEv2_M36', &
8655+
call MAPL_ease_convert('EASEv2_M36', &
86568656
Observations_l(ii)%lat, Observations_l(ii)%lon, col, row)
86578657

86588658
! note conversion to one-based indices
@@ -8671,7 +8671,7 @@ subroutine turn_off_assim_SMAP_L1CTb(N_obs_param, obs_param, N_obsl, Observation
86718671

86728672
if (Observations_l(ii)%species==species_L1C_Tbh_D) then
86738673

8674-
call ease_convert('EASEv2_M36', &
8674+
call MAPL_ease_convert('EASEv2_M36', &
86758675
Observations_l(ii)%lat, Observations_l(ii)%lon, col, row)
86768676

86778677
! note conversion to one-based indices
@@ -8692,7 +8692,7 @@ subroutine turn_off_assim_SMAP_L1CTb(N_obs_param, obs_param, N_obsl, Observation
86928692

86938693
if (Observations_l(ii)%species==species_L1C_Tbv_A) then
86948694

8695-
call ease_convert('EASEv2_M36', &
8695+
call MAPL_ease_convert('EASEv2_M36', &
86968696
Observations_l(ii)%lat, Observations_l(ii)%lon, col, row)
86978697

86988698
! note conversion to one-based indices
@@ -8711,7 +8711,7 @@ subroutine turn_off_assim_SMAP_L1CTb(N_obs_param, obs_param, N_obsl, Observation
87118711

87128712
if (Observations_l(ii)%species==species_L1C_Tbv_D) then
87138713

8714-
call ease_convert('EASEv2_M36', &
8714+
call MAPL_ease_convert('EASEv2_M36', &
87158715
Observations_l(ii)%lat, Observations_l(ii)%lon, col, row)
87168716

87178717
! note conversion to one-based indices

GEOSldas_App/ldas_setup

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -463,12 +463,15 @@ class LDASsetup:
463463
extension = os.path.splitext(tmptile)[1]
464464
if extension == '.domain':
465465
extension = os.path.splitext(tmptile)[0]
466-
466+
gridname_ =''
467467
if extension == '.til':
468-
self.rqdExeInp['GRIDNAME'] = linecache.getline(tmptile, 3).strip()
468+
gridname_ = linecache.getline(tmptile, 3).strip()
469469
else:
470470
nc_file = netCDF4.Dataset(tmptile,'r')
471-
self.rqdExeInp['GRIDNAME'] = nc_file.getncattr('Grid_Name')
471+
gridname_ = nc_file.getncattr('Grid_Name')
472+
# in case it is an old name: SMAP-EASEvx-Mxx
473+
gridname_ = gridname_.replace('SMAP-','').replace('-M','_M')
474+
self.rqdExeInp['GRIDNAME'] = gridname_
472475

473476
if 'LSM_CHOICE' not in self.rqdExeInp:
474477
self.rqdExeInp['LSM_CHOICE'] = 1

GEOSldas_App/preprocess_ldas_routines.F90

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2402,11 +2402,17 @@ subroutine optimize_latlon(fname_tilefile, N_proc_string, optimized_file, run_di
24022402
call ldas_abort(LDAS_GENERIC_ERROR, Iam, err_msg)
24032403
end if
24042404

2405+
if (index(gridname, 'SMAP') /=0 ) then
2406+
gridname = trim(adjustl(gridname))
2407+
gridname = gridname(6:)
2408+
gridname(7:7) = '_' ! replace '-' with '_'
2409+
endif
2410+
24052411
open(10,file=optimized_file, action='write')
2406-
write(10,'(A)') "GEOSldas.GRID_TYPE: LatLon"
2412+
write(10,'(A)') "GEOSldas.GRID_TYPE: EASE"
24072413
write(10,'(A)') "GEOSldas.GRIDNAME: "//trim(gridname)
24082414
write(10,'(A)') "GEOSldas.LM: 1"
2409-
write(10,'(A)') "GEOSldas.POLE: PE"
2415+
write(10,'(A)') "GEOSldas.POLE: XY"
24102416
write(10,'(A)') "GEOSldas.DATELINE: DE"
24112417
write(10,'(A,I6)') "GEOSldas.IM_WORLD: ", N_lon
24122418
write(10,'(A,I6)') "GEOSldas.JM_WORLD: ", N_lat

LDAS_Shared/LDAS_TileCoordRoutines.F90

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,9 @@ module LDAS_TileCoordRoutines
2626
use MAPL_ConstantsMod, ONLY: &
2727
MAPL_RADIUS ! Earth radius
2828

29-
use EASE_conv, ONLY: &
30-
ease_convert, &
31-
ease_inverse, &
32-
ease_extent
29+
use MAPL, ONLY: &
30+
MAPL_ease_convert, &
31+
MAPL_ease_extent
3332

3433
use LDAS_ExceptionsMod, ONLY: &
3534
ldas_abort, &
@@ -380,7 +379,7 @@ subroutine LDAS_create_grid_g( gridname, n_lon, n_lat, &
380379
tile_grid%i_dir = +1
381380
tile_grid%j_dir = -1
382381

383-
call ease_extent ( &
382+
call MAPL_ease_extent ( &
384383
gridname, cols, rows, &
385384
cell_area = ease_cell_area, & ! [m^2]
386385
ll_lon = tile_grid%ll_lon, &
@@ -1002,7 +1001,7 @@ subroutine get_ij_ind_from_latlon( tile_grid, lat, lon, i_ind, j_ind )
10021001

10031002
! EASE grid lat/lon to index provides *global*, *0-based* index!
10041003

1005-
call ease_convert(tile_grid%gridtype, lat, lon, r, s)
1004+
call MAPL_ease_convert(tile_grid%gridtype, lat, lon, r, s)
10061005

10071006
i_indg = nint(r) ! i_ind or lon_ind
10081007
j_indg = nint(s) ! j_ind or lat_ind

0 commit comments

Comments
 (0)