Skip to content

Commit 547c512

Browse files
Comment out static QC mask in CYGNSS reader; bump ASCAT max obs limit #151
2 parents b42bb3e + 2663052 commit 547c512

File tree

2 files changed

+90
-81
lines changed

2 files changed

+90
-81
lines changed

CHANGELOG.md

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

1717
### Changed
1818

19+
- Bumped max_obs limit from 250k to 280k in ASCAT reader.
20+
- Commented out static QC mask in CYGNSS reader and guarded mask deallocation when disabled.
1921
- Cleaned up ldas_setup. Split out ldas.py and setup_utils.py.
2022
- Added reader for surface meteorological forcing from S2S-3.
2123
- Update `GEOSlandassim_GridComp/io_hdf5.F90` to allow for use with HDF5 1.14.
@@ -151,4 +153,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
151153

152154
-----------------------------
153155

154-

GEOSlandassim_GridComp/clsm_ensupd_read_obs.F90

Lines changed: 88 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,7 +1643,7 @@ subroutine read_obs_sm_ASCAT_EUMET( &
16431643

16441644
integer, parameter :: lnbufr = 50 ! BUFR file unit number
16451645
integer, parameter :: max_rec = 50000 ! max number of obs after QC (expecting < 6 hr assim window)
1646-
integer, parameter :: max_obs = 250000 ! max number of obs read by subroutine (expecting < 6 hr assim window)
1646+
integer, parameter :: max_obs = 280000 ! max number of obs read by subroutine (expecting < 6 hr assim window)
16471647

16481648
integer :: idate, iret, ireadmg, ireadsb
16491649

@@ -2427,78 +2427,87 @@ subroutine read_obs_sm_CYGNSS( &
24272427
! close the obs file
24282428
ierr = nf90_close(ncid)
24292429

2430-
! get name for CYGNSS mask file
2431-
2432-
tmpmaskname = trim(this_obs_param%maskpath) // '/' // trim(this_obs_param%maskname) // '.nc'
2433-
2434-
inquire(file=tmpfname, exist=file_exists)
2435-
2436-
if (.not. file_exists) then
2437-
err_msg = 'CYGNSS mask file not found!'
2438-
call ldas_abort(LDAS_GENERIC_ERROR, Iam, err_msg)
2439-
end if
2440-
2441-
! open the CYGNSS mask file
2442-
2443-
ierr = nf90_open(trim(tmpmaskname), nf90_nowrite, ncid)
2444-
2445-
! get variable dimension IDs
2446-
ierr = nf90_inq_dimid(ncid, 'lon', lon_dimid)
2447-
ierr = nf90_inq_dimid(ncid, 'lat', lat_dimid)
2448-
2449-
! dimensions sizes
2450-
ierr = nf90_inquire_dimension(ncid, lon_dimid, len=N_lon_m)
2451-
ierr = nf90_inquire_dimension(ncid, lat_dimid, len=N_lat_m)
2452-
2453-
! get variable IDs
2454-
ierr = nf90_inq_varid(ncid, 'longitude', longitudes_m_varid)
2455-
ierr = nf90_inq_varid(ncid, 'latitude', latitudes_m_varid)
2456-
ierr = nf90_inq_varid(ncid, 'flag_small_SM_range', small_SM_range_varid)
2457-
ierr = nf90_inq_varid(ncid, 'flag_poor_SMAP', poor_SMAP_varid)
2458-
ierr = nf90_inq_varid(ncid, 'flag_high_ubrmsd', high_ubrmsd_varid)
2459-
ierr = nf90_inq_varid(ncid, 'flag_few_obs', few_obs_varid)
2460-
ierr = nf90_inq_varid(ncid, 'flag_low_signal', low_signal_varid)
2461-
2462-
! allocate memory for the variables
2463-
allocate(latitudes_m( N_lon_m, N_lat_m))
2464-
allocate(longitudes_m( N_lon_m, N_lat_m))
2465-
allocate(small_SM_range_flag(N_lon_m, N_lat_m))
2466-
allocate(poor_SMAP_flag( N_lon_m, N_lat_m))
2467-
allocate(high_ubrmsd_flag( N_lon_m, N_lat_m))
2468-
allocate(few_obs_flag( N_lon_m, N_lat_m))
2469-
allocate(low_signal_flag( N_lon_m, N_lat_m))
2470-
2471-
! read the variables
2472-
ierr = nf90_get_var(ncid, latitudes_m_varid, latitudes_m)
2473-
ierr = nf90_get_var(ncid, longitudes_m_varid, longitudes_m)
2474-
ierr = nf90_get_var(ncid, small_SM_range_varid, small_SM_range_flag)
2475-
ierr = nf90_get_var(ncid, poor_SMAP_varid, poor_SMAP_flag)
2476-
ierr = nf90_get_var(ncid, high_ubrmsd_varid, high_ubrmsd_flag)
2477-
ierr = nf90_get_var(ncid, few_obs_varid, few_obs_flag)
2478-
ierr = nf90_get_var(ncid, low_signal_varid, low_signal_flag)
2479-
2480-
! close the mask file
2481-
ierr = nf90_close(ncid)
2482-
2483-
! check the obs data and mask data are the same resolution
2484-
if (N_lon /= N_lon_m .or. N_lat /= N_lat_m) then
2485-
err_msg = 'The mask file ' // trim(this_obs_param%maskname) // ' does not match the obs resolution'
2486-
call ldas_abort(LDAS_GENERIC_ERROR, Iam, err_msg)
2487-
end if
2488-
2489-
good_flag_value = 255 ! should really be 0 but is 255 because of unsigned v. signed byte issues
2430+
! ----------------------------------------------------------------
2431+
! AMF, November 2025
2432+
! Original CYGNSS mask reading section commented out - masks not currently used
2433+
! Mask originally developed for version 1.0 of CYGNSS soil moisture product and
2434+
! not believed to be appropriate for version 3.2 product being used here.
2435+
! ----------------------------------------------------------------
2436+
2437+
! ! get name for CYGNSS mask file
2438+
2439+
! tmpmaskname = trim(this_obs_param%maskpath) // '/' // trim(this_obs_param%maskname) // '.nc'
2440+
2441+
! inquire(file=tmpfname, exist=file_exists)
2442+
2443+
! if (.not. file_exists) then
2444+
! err_msg = 'CYGNSS mask file not found!'
2445+
! call ldas_abort(LDAS_GENERIC_ERROR, Iam, err_msg)
2446+
! end if
2447+
2448+
! ! open the CYGNSS mask file
2449+
2450+
! ierr = nf90_open(trim(tmpmaskname), nf90_nowrite, ncid)
2451+
2452+
! ! get variable dimension IDs
2453+
! ierr = nf90_inq_dimid(ncid, 'lon', lon_dimid)
2454+
! ierr = nf90_inq_dimid(ncid, 'lat', lat_dimid)
2455+
2456+
! ! dimensions sizes
2457+
! ierr = nf90_inquire_dimension(ncid, lon_dimid, len=N_lon_m)
2458+
! ierr = nf90_inquire_dimension(ncid, lat_dimid, len=N_lat_m)
2459+
2460+
! ! get variable IDs
2461+
! ierr = nf90_inq_varid(ncid, 'longitude', longitudes_m_varid)
2462+
! ierr = nf90_inq_varid(ncid, 'latitude', latitudes_m_varid)
2463+
! ierr = nf90_inq_varid(ncid, 'flag_small_SM_range', small_SM_range_varid)
2464+
! ierr = nf90_inq_varid(ncid, 'flag_poor_SMAP', poor_SMAP_varid)
2465+
! ierr = nf90_inq_varid(ncid, 'flag_high_ubrmsd', high_ubrmsd_varid)
2466+
! ierr = nf90_inq_varid(ncid, 'flag_few_obs', few_obs_varid)
2467+
! ierr = nf90_inq_varid(ncid, 'flag_low_signal', low_signal_varid)
2468+
2469+
! ! allocate memory for the variables
2470+
! allocate(latitudes_m( N_lon_m, N_lat_m))
2471+
! allocate(longitudes_m( N_lon_m, N_lat_m))
2472+
! allocate(small_SM_range_flag(N_lon_m, N_lat_m))
2473+
! allocate(poor_SMAP_flag( N_lon_m, N_lat_m))
2474+
! allocate(high_ubrmsd_flag( N_lon_m, N_lat_m))
2475+
! allocate(few_obs_flag( N_lon_m, N_lat_m))
2476+
! allocate(low_signal_flag( N_lon_m, N_lat_m))
2477+
2478+
! ! read the variables
2479+
! ierr = nf90_get_var(ncid, latitudes_m_varid, latitudes_m)
2480+
! ierr = nf90_get_var(ncid, longitudes_m_varid, longitudes_m)
2481+
! ierr = nf90_get_var(ncid, small_SM_range_varid, small_SM_range_flag)
2482+
! ierr = nf90_get_var(ncid, poor_SMAP_varid, poor_SMAP_flag)
2483+
! ierr = nf90_get_var(ncid, high_ubrmsd_varid, high_ubrmsd_flag)
2484+
! ierr = nf90_get_var(ncid, few_obs_varid, few_obs_flag)
2485+
! ierr = nf90_get_var(ncid, low_signal_varid, low_signal_flag)
2486+
2487+
! ! close the mask file
2488+
! ierr = nf90_close(ncid)
2489+
2490+
! ! check the obs data and mask data are the same resolution
2491+
! if (N_lon /= N_lon_m .or. N_lat /= N_lat_m) then
2492+
! err_msg = 'The mask file ' // trim(this_obs_param%maskname) // ' does not match the obs resolution'
2493+
! call ldas_abort(LDAS_GENERIC_ERROR, Iam, err_msg)
2494+
! end if
2495+
2496+
! good_flag_value = 255 ! should really be 0 but is 255 because of unsigned v. signed byte issues
24902497

24912498
! fill tmp arrays
24922499
N_obs = 0
24932500

24942501
do i = 1, N_lon
24952502
do j = 1, N_lat
2496-
if (tmp_sm(i,j) .ne. this_obs_param%nodata .and. &
2497-
small_SM_range_flag(i,j) == good_flag_value .and. &
2498-
poor_SMAP_flag(i,j) == good_flag_value .and. &
2499-
high_ubrmsd_flag(i,j) == good_flag_value .and. &
2500-
few_obs_flag(i,j) == good_flag_value .and. &
2501-
low_signal_flag(i,j) == good_flag_value ) then
2503+
! if (tmp_sm(i,j) .ne. this_obs_param%nodata .and. &
2504+
! small_SM_range_flag(i,j) == good_flag_value .and. &
2505+
! poor_SMAP_flag(i,j) == good_flag_value .and. &
2506+
! high_ubrmsd_flag(i,j) == good_flag_value .and. &
2507+
! few_obs_flag(i,j) == good_flag_value .and. &
2508+
! low_signal_flag(i,j) == good_flag_value ) then
2509+
2510+
if (tmp_sm(i,j) .ne. this_obs_param%nodata) then
25022511

25032512
! valid observation
25042513
N_obs = N_obs + 1
@@ -2631,18 +2640,18 @@ subroutine read_obs_sm_CYGNSS( &
26312640

26322641
! clean up
26332642

2634-
deallocate(timeintervals)
2635-
deallocate(latitudes)
2636-
deallocate(longitudes)
2637-
deallocate(tmp_sm)
2638-
deallocate(tmp_sigma)
2639-
deallocate(latitudes_m)
2640-
deallocate(longitudes_m)
2641-
deallocate(small_SM_range_flag)
2642-
deallocate(poor_SMAP_flag)
2643-
deallocate(high_ubrmsd_flag)
2644-
deallocate(few_obs_flag)
2645-
deallocate(low_signal_flag)
2643+
if (allocated(timeintervals)) deallocate(timeintervals)
2644+
if (allocated(latitudes)) deallocate(latitudes)
2645+
if (allocated(longitudes)) deallocate(longitudes)
2646+
if (allocated(tmp_sm)) deallocate(tmp_sm)
2647+
if (allocated(tmp_sigma)) deallocate(tmp_sigma)
2648+
if (allocated(latitudes_m)) deallocate(latitudes_m)
2649+
if (allocated(longitudes_m)) deallocate(longitudes_m)
2650+
if (allocated(small_SM_range_flag)) deallocate(small_SM_range_flag)
2651+
if (allocated(poor_SMAP_flag)) deallocate(poor_SMAP_flag)
2652+
if (allocated(high_ubrmsd_flag)) deallocate(high_ubrmsd_flag)
2653+
if (allocated(few_obs_flag)) deallocate(few_obs_flag)
2654+
if (allocated(low_signal_flag)) deallocate(low_signal_flag)
26462655

26472656
if (associated(tmp_obs)) deallocate(tmp_obs)
26482657
if (associated(tmp_lon)) deallocate(tmp_lon)
@@ -11069,4 +11078,3 @@ end program test
1106911078
#endif
1107011079

1107111080
! ******* EOF *************************************************************
11072-

0 commit comments

Comments
 (0)