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

Merge/handmerge/mapl3 2023 dec20 #2502

Merged
merged 58 commits into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
5e58c48
Temp add to the table: template + geoval names
metdyn Oct 11, 2023
87fb4c5
temp save for multiple geoval in multi IODA
metdyn Oct 18, 2023
6d6b168
delete subroutine reinitialize
metdyn Oct 19, 2023
b6ae7d7
.
metdyn Oct 19, 2023
65632f0
Save a copy: the first version that seperates var2 vs var3 in nf90_p…
metdyn Oct 19, 2023
d3000f9
.
metdyn Oct 20, 2023
849b969
upate
metdyn Oct 23, 2023
fc637c8
update union_field_name
metdyn Oct 24, 2023
ae0e1a4
update
metdyn Oct 24, 2023
b83d674
update
metdyn Oct 24, 2023
696f61d
...
metdyn Oct 25, 2023
83a4126
.
metdyn Oct 25, 2023
5d976da
update
metdyn Oct 25, 2023
2371788
.
metdyn Oct 25, 2023
205573a
update
metdyn Oct 27, 2023
79186c6
geovals.nc_Index: is written in *.rcx
metdyn Oct 31, 2023
e32d909
code can generate aircraft.geovals.20190801_0300z.nc4
metdyn Oct 31, 2023
78db134
Field entry such as TS in the example below can be written to NC4:
metdyn Nov 6, 2023
3281e15
Fix a bug when considering the case --- Field:
metdyn Nov 7, 2023
384ec11
Test to move file template to MPAL_Obsmodule.F90
metdyn Nov 7, 2023
1014a5b
Add MAPL_ObsUtil.F90
metdyn Nov 7, 2023
5777269
.
metdyn Nov 7, 2023
cba5bdd
.
metdyn Nov 7, 2023
57ccc19
temp. save; removed file template function from MAPL_HistoryTrajecto…
metdyn Nov 8, 2023
98b74c5
MAPL_ObsUtil.F90 works for trajectory
metdyn Nov 8, 2023
7e135ca
Added info in _ASSERT messages to aid in debugging ExtData.yaml files
mmanyin Nov 20, 2023
2aa20fd
Merge branch 'develop' into feature/ygyu/mapl_obsmodule
metdyn Dec 1, 2023
caba1b1
.
metdyn Dec 1, 2023
c92501c
Merge branch 'feature/ygyu/PR_swath_2_epoch' into feature/ygyu/mapl_o…
metdyn Dec 1, 2023
98b1df8
Add lgr%debug information (run without using logging.yaml is faster)
metdyn Dec 1, 2023
f84f931
Move obs_platform to MAPL_ObsUtil.F90
metdyn Dec 1, 2023
8e19a6d
Merge branch 'develop' into feature/ygyu/mapl_obsmodule
metdyn Dec 1, 2023
7813bda
Add notes to CHANGELOG.md to highlight `type obs_platform` and `funct…
metdyn Dec 1, 2023
cb705ba
Code clean up
metdyn Dec 1, 2023
ccce690
Make a few corrections
metdyn Dec 1, 2023
f07e904
delete subroutine error_nostop etc.
metdyn Dec 4, 2023
bfa4597
Merge branch 'develop' into feature/mmanyin/ExtData_explain_error
mathomp4 Dec 5, 2023
493d497
Station sampler: add support to Global Historical Climatology Network…
metdyn Dec 5, 2023
87915a6
Changed _ASSERT(.false. to _FAIL(
mmanyin Dec 5, 2023
8c84bb9
Station sampler: move output freqquency, duration to the POSTLOOP [ i…
metdyn Dec 5, 2023
28d4efa
delete ls system call in MAPL_ObsUtil.F90
metdyn Dec 7, 2023
d0392d3
Add inquire() statement to skip / set non-existing filename=empty
metdyn Dec 7, 2023
606e6c5
Merge branch 'develop' into feature/ygyu/aeronet_revise
metdyn Dec 11, 2023
d52ce5a
Merge branch 'develop' into feature/ygyu/mapl_obsmodule
metdyn Dec 12, 2023
7dbaf05
Sampler code does not support wild character (*) in filenames
metdyn Dec 12, 2023
c6148f7
Merge branch 'develop' into feature/mmanyin/ExtData_explain_error
mmanyin Dec 15, 2023
1dba094
Merge branch 'develop' into feature/ygyu/aeronet_revise
mathomp4 Dec 15, 2023
e8b7ede
Merge branch 'develop' into feature/ygyu/mapl_obsmodule
mathomp4 Dec 20, 2023
7fa6ca1
Allow ExtData2G to be built static
mathomp4 Dec 20, 2023
2eb9da2
Merge pull request #2500 from GEOS-ESM/feature/mathomp4/2499-fix-shar…
mathomp4 Dec 20, 2023
d847a29
Merge branch 'develop' into feature/mmanyin/ExtData_explain_error
mathomp4 Dec 20, 2023
7086edb
Merge pull request #2452 from GEOS-ESM/feature/mmanyin/ExtData_explai…
mathomp4 Dec 20, 2023
bdb8074
Merge branch 'develop' into feature/ygyu/mapl_obsmodule
mathomp4 Dec 20, 2023
b304b5a
Merge pull request #2465 from GEOS-ESM/feature/ygyu/mapl_obsmodule
mathomp4 Dec 20, 2023
ee6a9c8
Merge branch 'develop' into feature/ygyu/aeronet_revise
mathomp4 Dec 20, 2023
85d64fb
Merge pull request #2477 from GEOS-ESM/feature/ygyu/aeronet_revise
mathomp4 Dec 20, 2023
de06924
Merge branch 'develop' into release/MAPL-v3
mathomp4 Dec 20, 2023
38966da
Fix bad conflict resolve
mathomp4 Dec 20, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Station sampler: add support to Global Historical Climatology Network Daily (GHCN-D)
- Add to trajectory sampler DEFINE_OBS_PLATFORM for reading multiple IODA files. To do this, we add union_platform function for observation.
- New directory (`docs/tutorial/grid_comps/automatic_code_generator`) containing an example showing how to automatically generate the source code using the `MAPL_GridCompSpecs_ACG.py` tool.
- Added/modified a few _ASSERT calls in ExtData, to better explain what is wrong in .yaml file

### Changed

- Change the verification of the grid in MAPL_GetGlobalHorzIJIndex to avoid collective call
- Swath grid step 1: allow for destroying and regenerating swath grid and regenerating regridder route handle, and creating
allocatable metadata in griddedIO. Modifications are made to GriddedIO.F90, MAPL_AbstractRegridder.F90, and MAPL_EsmfRegridder.F90.
- Swath grid step 2: add control keywords for swath grid. Allow for filename template with `'*'` and DOY. Allow for missing obs files. Specify index_name_lon/lat, var_name_lon/lat/time, tunit, obs_file_begin/end/interval, Epoch and Epoch_init.
- Swath grid step 2: add control keywords for swath grid. Allow for filename template with DOY. Allow for missing obs files. User needs to specify index_name_lon/lat, var_name_lon/lat/time, tunit, obs_file_begin/end/interval, Epoch and Epoch_init.
- Update CI to Baselibs 7.17.0 (for future MAPL3 work) and the BCs v11.3.0 (to fix coupled run)
- Update `components.yaml`
- ESMA_env v4.24.0 (Baselibs 7.17.0)
Expand All @@ -74,6 +78,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Missing TARGET in GriddedIO - exposed runtime error when using NAG + debug.
- Corrected some unit tests (and test utilities) to fix dangling pointers detected by NAG. Most (possibly all) of these changes are already on release/MAPL-v3, but it was getting annoying to have NAG fail unit tests with develop branch.
- Fix for CMake an Apple. Needs to set `__DARWIN` as an fpp flag. (Only used by NAG, but ...)
- Allow ExtData2G to be built as SHARED or STATIC

### Removed

Expand Down
134 changes: 107 additions & 27 deletions base/MAPL_ObsUtil.F90
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,43 @@ module MAPL_ObsUtilMod
use Plain_netCDF_Time
use netCDF
use MAPL_CommsMod, only : MAPL_AM_I_ROOT
use pFIO_FileMetadataMod, only : FileMetadata
use pFIO_NetCDF4_FileFormatterMod, only : NetCDF4_FileFormatter
use, intrinsic :: iso_fortran_env, only: REAL32, REAL64
implicit none
integer, parameter :: mx_ngeoval = 60
!! private

public :: obs_unit
type :: obs_unit
integer :: nobs_epoch
integer :: ngeoval
logical :: export_all_geoval
type(FileMetadata), allocatable :: metadata
type(NetCDF4_FileFormatter), allocatable :: file_handle
character(len=ESMF_MAXSTR) :: name
character(len=ESMF_MAXSTR) :: obsFile_output
character(len=ESMF_MAXSTR) :: input_template
character(len=ESMF_MAXSTR) :: geoval_name(mx_ngeoval)
real(kind=REAL64), allocatable :: lons(:)
real(kind=REAL64), allocatable :: lats(:)
real(kind=REAL64), allocatable :: times_R8(:)
real(kind=REAL32), allocatable :: p2d(:)
real(kind=REAL32), allocatable :: p3d(:,:)
end type obs_unit

type obs_platform
character (len=ESMF_MAXSTR) :: name=''
character (len=ESMF_MAXSTR) :: nc_index=''
character (len=ESMF_MAXSTR) :: nc_lon=''
character (len=ESMF_MAXSTR) :: nc_lat=''
character (len=ESMF_MAXSTR) :: nc_time=''
character (len=ESMF_MAXSTR) :: file_name_template=''
integer :: ngeoval=0
integer :: nentry_name=0
character (len=ESMF_MAXSTR), allocatable :: field_name(:,:)
!character (len=ESMF_MAXSTR), allocatable :: field_name(:)
end type obs_platform

interface sort_multi_arrays_by_time
module procedure sort_three_arrays_by_time
Expand Down Expand Up @@ -92,7 +127,6 @@ function get_filename_from_template (time, file_template, rc) result(filename)
end function get_filename_from_template



subroutine time_real_to_ESMF (times_R8_1d, times_esmf_1d, datetime_units, rc)
use MAPL_NetCDF, only : convert_NetCDF_DateTime_to_ESMF

Expand Down Expand Up @@ -359,6 +393,7 @@ function get_filename_from_template_use_index (obsfile_start_time, obsfile_inter
type(ESMF_TimeInterval) :: dT
type(ESMF_Time) :: time
integer :: i, j, u
logical :: EX

character(len=ESMF_MAXSTR) :: file_template_left
character(len=ESMF_MAXSTR) :: file_template_right
Expand All @@ -376,32 +411,12 @@ function get_filename_from_template_use_index (obsfile_start_time, obsfile_inter
nymd = itime(1)
nhms = itime(2)


j= index(file_template, '*')
if (j>0) then
! wild char exist
!!print*, 'pos of * in template =', j
file_template_left = file_template(1:j-1)
call fill_grads_template ( filename_left, file_template_left, &
experiment_id='', nymd=nymd, nhms=nhms, _RC )
filename= trim(filename_left)//trim(file_template(j:))
cmd="bash -c 'ls "//trim(filename)//"' &> zzz_MAPL"
CALL execute_command_line(trim(cmd))
open(newunit=u, file='zzz_MAPL', status='unknown')
read(u, '(a)') filename
i=index(trim(filename), 'ls')
if (i==1) then
filename=''
end if
! cmd="rm -f ./zzz_MAPL"
! CALL execute_command_line(trim(cmd))
close(u)
else
! exact file name
call fill_grads_template ( filename, file_template, &
experiment_id='', nymd=nymd, nhms=nhms, _RC )
end if

! parse time info
!
call fill_grads_template ( filename, file_template, &
experiment_id='', nymd=nymd, nhms=nhms, _RC )
inquire(file= trim(filename), EXIST = EX)
if(.not.EX) filename=''

_RETURN(_SUCCESS)

Expand Down Expand Up @@ -541,4 +556,69 @@ subroutine sort_four_arrays_by_time(U,V,T,ID,rc)
_RETURN(_SUCCESS)
end subroutine sort_four_arrays_by_time



function copy_platform_nckeys(a, rc)
type(obs_platform) :: copy_platform_nckeys
type(obs_platform), intent(in) :: a
integer, optional, intent(out) :: rc

copy_platform_nckeys%nc_index = a%nc_index
copy_platform_nckeys%nc_lon = a%nc_lon
copy_platform_nckeys%nc_lat = a%nc_lat
copy_platform_nckeys%nc_time = a%nc_time
copy_platform_nckeys%nentry_name = a%nentry_name
_RETURN(_SUCCESS)

end function copy_platform_nckeys


function union_platform(a, b, rc)
type(obs_platform) :: union_platform
type(obs_platform), intent(in) :: a
type(obs_platform), intent(in) :: b
integer, optional, intent(out) :: rc

character (len=ESMF_MAXSTR), allocatable :: field_name_loc(:,:)
integer :: nfield, nentry_name
integer, allocatable :: tag(:)
integer :: i, j, k
integer :: status

union_platform = copy_platform_nckeys(a, _RC)
nfield = a%ngeoval + b%ngeoval
allocate (tag(b%ngeoval))

tag(:)=1 ! true
k=nfield
do j=1, b%ngeoval
do i=1, a%ngeoval
if ( trim(b%field_name(1,j)) == trim(a%field_name(1,i)) ) then
tag(j)=0
endif
enddo
if (tag(j)==0) k=k-1
enddo
union_platform%ngeoval=k
nfield=k
nentry_name=union_platform%nentry_name
if ( allocated (union_platform%field_name) ) deallocate(union_platform%field_name)
allocate(union_platform%field_name(nentry_name, nfield))
do i=1, a%ngeoval
union_platform%field_name(:,i) = a%field_name(:,i)
enddo
if (nfield>a%ngeoval) then
k = a%ngeoval
do j=1, b%ngeoval
if (tag(j)==1) then
k = k + 1
union_platform%field_name(:,k) = b%field_name(:,j)
end if
enddo
end if
_RETURN(_SUCCESS)

end function union_platform


end module MAPL_ObsUtilMod
Loading