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

Sentinel-1 VV VH backscatter DA #1208

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
61 changes: 39 additions & 22 deletions lis/arch/Config.pl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
# All Rights Reserved.
#-------------------------END NOTICE -- DO NOT EDIT-----------------------
# 6 Jan 2012: Sujay Kumar, Initial Specification

#
# 15 Sep 2020: Sara Modanesi, added specification for USE_WCM (Water Cloud Model)
# 11 Nov 2020: Alexander Gruber/Sara Modanesi, use lis-crtm-profile-utility also for other RTMs
# Process environment and configure options
#

Expand Down Expand Up @@ -734,6 +734,13 @@
}


print "Use LIS-WCM? (1-yes, 0-no, default=0): ";
$use_wcm=<stdin>;
chomp($use_wcm);
if($use_wcm eq ""){
$use_wcm=0;
}

print "Use LIS-CRTM? (1-yes, 0-no, default=0): ";
$use_crtm=<stdin>;
$use_crtm=~s/ *#.*$//;
Expand All @@ -758,24 +765,8 @@
print "--------------ERROR---------------------\n";
exit 1;
}
if(defined($ENV{LIS_CRTM_PROF})){
$sys_crtm_prof_path = $ENV{LIS_CRTM_PROF};
$inc = "/include/";
$lib = "/lib/";
$inc_crtm_prof=$sys_crtm_prof_path.$inc;
$lib_crtm_prof=$sys_crtm_prof_path.$lib;
}
else {
print "--------------ERROR----------------------------------\n";
print "Please specify the CRTM profile utility path using\n";
print "the LIS_CRTM_PROF variable.\n";
print "Configuration exiting ....\n";
print "--------------ERROR----------------------------------\n";
exit 1;
}
}


print "Use LIS-CMEM? (1-yes, 0-no, default=0): ";
$use_cmem=<stdin>;
$use_cmem=~s/ *#.*$//;
Expand All @@ -802,6 +793,24 @@
}
}

if($use_crtm == 1 || $use_cmem == 1 || $use_wcm == 1) {
if(defined($ENV{LIS_CRTM_PROF})){
$sys_crtm_prof_path = $ENV{LIS_CRTM_PROF};
$inc = "/include/";
$lib = "/lib/";
$inc_crtm_prof=$sys_crtm_prof_path.$inc;
$lib_crtm_prof=$sys_crtm_prof_path.$lib;
}
else {
print "--------------ERROR----------------------------------\n";
print "Please specify the CRTM profile utility path using\n";
print "the LIS_CRTM_PROF variable.\n";
print "Configuration exiting ....\n";
print "--------------ERROR----------------------------------\n";
exit 1;
}
}

print "Use LIS-LAPACK? (1-yes, 0-no, default=0): ";
$use_lapack=<stdin>;
$use_lapack=~s/ *#.*$//;
Expand Down Expand Up @@ -1011,10 +1020,11 @@
}
$lib_paths= $lib_paths." -L\$(LIB_HDF5)";
}

if($use_crtm == 1){
$fflags77 = $fflags77." -I\$(INC_CRTM) -I\$(INC_PROF_UTIL)";
$fflags = $fflags." -I\$(INC_CRTM) -I\$(INC_PROF_UTIL)";
$ldflags = $ldflags." -L\$(LIB_CRTM) -lCRTM -L\$(LIB_PROF_UTIL) -lProfile_Utility";
$fflags77 = $fflags77." -I\$(INC_CRTM)";
$fflags = $fflags." -I\$(INC_CRTM)";
$ldflags = $ldflags." -L\$(LIB_CRTM) -lCRTM";
$lib_flags= $lib_flags." -lCRTM -lProfile_Utility";
$lib_paths= $lib_paths." -L\$(LIB_CRTM) -L\$(LIB_PROF_UTIL)";
}
Expand All @@ -1027,6 +1037,12 @@
$lib_paths= $lib_paths." -L\$(LIB_CMEM)";
}

if($use_crtm == 1 || $use_cmem == 1 || $use_wcm == 1) {
$fflags77 = $fflags77." -I\$(INC_PROF_UTIL)";
$fflags = $fflags." -I\$(INC_PROF_UTIL)";
$ldflags = $ldflags." -L\$(LIB_PROF_UTIL) -lProfile_Utility";
}

if($use_minpack == 1){
$ldflags = $ldflags." -L\$(LIB_MINPACK) -lminpack";
$lib_flags= $lib_flags." -lminpack";
Expand Down Expand Up @@ -1203,13 +1219,14 @@
printf misc_file "%s\n","#undef USE_MINPACK ";
}

if($use_crtm == 1 || $use_cmem == 1) {
if($use_crtm == 1 || $use_cmem == 1 || $use_wcm == 1) {
printf misc_file "%s\n","#define RTMS ";
}
else{
printf misc_file "%s\n","#undef RTMS ";
}


if($use_lapack == 1) {
printf misc_file "%s\n","#define LAPACK ";
}
Expand Down
14 changes: 14 additions & 0 deletions lis/configs/lis.config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,8 @@ Acceptable values are:
|"`ANSA snow depth`" | ANSA snow depth
|"`SMMR snow depth`" | SMMR snow depth
|"`SMMI snow depth`" | SMMI snow depth
|"`S1 backscatter VVSM`" | S1 backscatter VV for SM
|"`S1 backscatter VVVHSMLAI`" | S1 backscatter VV and VH joint assim for SM and LAI
|"`AMSR-E SWE`" | AMSR-E SWE
|"`PMW snow`" | PMW-based SWE or snow depth
|"`MODIS SCF`" | MODIS SCF
Expand Down Expand Up @@ -2243,6 +2245,18 @@ SMMR snow depth data directory: ./SMMR
....


[[sssec_s1backscatterda,S1 backscatter Assimilation]]
==== S1 backscatter Assimilation

`S1 backscatter data directory:` specifies the directory for the
S1 backscatter data.

.Example _lis.config_ entry
....
S1 backscatter data directory: ./S1
....


[[sssec_ssmisnowdepthda,SSMI snow depth Assimilation]]
==== SSMI snow depth Assimilation

Expand Down
34 changes: 22 additions & 12 deletions lis/core/LIS_DAobservationsMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ module LIS_DAobservationsMod
! !REVISION HISTORY:
!
! 21 Jun 2006: Sujay Kumar; Initial implementation
! 10 Mar 2022: Michel Bechtold (MB); Bug Fix for multiple obstypes
!
use ESMF
use LIS_coreMod
Expand Down Expand Up @@ -324,7 +325,7 @@ subroutine create_obsdomain_objects()
integer, allocatable :: deblklist(:,:,:)
type(ESMF_DistGrid) :: obsgridDG(LIS_rc%ndas), gridEnsDG(LIS_rc%ndas)
integer :: stid, enid
integer :: n, i, k
integer :: n, i, k, m
integer :: status, ierr

call readObsDomainInput()
Expand All @@ -337,8 +338,9 @@ subroutine create_obsdomain_objects()
do n=1,LIS_rc%nnest

do k=1,LIS_rc%ndas
! odeltas(k) = LIS_rc%obs_ngrid(k)*LIS_rc%nobtypes(k)
odeltas(k) = LIS_rc%obs_ngrid(k)
!MB: bug fix multiple obstypes
odeltas(k) = LIS_rc%obs_ngrid(k)*LIS_rc%nobtypes(k)
! odeltas(k) = LIS_rc%obs_ngrid(k)
enddo
!-----------------------------------------------------------------------------
! The grid, tile space sizes of the decomposed domains are gathered
Expand Down Expand Up @@ -375,27 +377,31 @@ subroutine create_obsdomain_objects()
allocate(deblklist(1,2,LIS_npes))
do i=0,LIS_npes-1
stid = LIS_ooffsets(k,i)+1
enid = stid + LIS_obs_ngrids(k,i)-1
!MB: bug fix multiple obstypes
enid = stid + LIS_obs_ngrids(k,i)*LIS_rc%nobtypes(k)-1

deblklist(:,1,i+1) = (/stid/)
deblklist(:,2,i+1) = (/enid/)
enddo
!MB: bug fix multiple obstypes
obsgridDG(k) = ESMF_DistGridCreate(minIndex=(/1/), &
maxIndex=(/LIS_rc%obs_glbngrid(k)/),&
maxIndex=(/LIS_rc%obs_glbngrid(k)*LIS_rc%nobtypes(k)/),&
deBlockList=deblklist,rc=status)
call LIS_verify(status, 'ESMF_DistGridCreate failed: obsgridDG')
deallocate(deblklist)

allocate(deblklist(2,2,LIS_npes))
do i=0,LIS_npes-1
stid = LIS_ooffsets(k,i)+1
enid = stid+LIS_obs_ngrids(k,i)-1
!MB: bug fix multiple obstypes
enid = stid+LIS_obs_ngrids(k,i)*LIS_rc%nobtypes(k)-1
deblklist(:,1,i+1) = (/stid,1/)
deblklist(:,2,i+1) = (/enid,LIS_rc%nensem(n)/)
enddo

!MB: bug fix multiple obstypes
gridEnsDG(k) = ESMF_DistGridCreate(minIndex=(/1,1/),&
maxIndex=(/LIS_rc%obs_glbngrid(k),LIS_rc%nensem(n)/),&
maxIndex=(/LIS_rc%obs_glbngrid(k)*LIS_rc%nobtypes(k),LIS_rc%nensem(n)/),&
deBlockList=deblklist,rc=status)
call LIS_verify(status, 'ESMF_DistGridCreate failed: gridEnsDG')

Expand Down Expand Up @@ -2035,12 +2041,16 @@ subroutine LIS_writevar_innov(ftn, n, k, varid, var)
#else
gtmp = var
#endif
if(LIS_masterproc) then
if(LIS_masterproc) then
!MB: bug fix multiple obstypes
do i=1,LIS_rc%nobtypes(k)
count1=1 + (i-1)*SUM(LIS_obs_ngrids(k,0:i-2))
gtmp1 = LIS_rc%udef
count1=1

do l=1,LIS_npes
count1=count1+MIN0(1,l-1)*&
(LIS_rc%nobtypes(k)-i)*LIS_obs_ngrids(k,l-2) +&
MIN0(1,l-1)*&
(i-1)*LIS_obs_ngrids(k,l-1)
do t =1, LIS_obs_ngrids(k,l-1)
c = LIS_obs_domain(n,k)%glb_col(l,t)
r = LIS_obs_domain(n,k)%glb_row(l,t)
Expand All @@ -2053,8 +2063,8 @@ subroutine LIS_writevar_innov(ftn, n, k, varid, var)
enddo
enddo
#if ( defined USE_NETCDF3 || defined USE_NETCDF4 )
ierr = nf90_put_var(ftn,varid,gtmp1,(/1,1,1/),&
(/LIS_rc%obs_gnc(k),LIS_rc%obs_gnr(k),i/))
ierr = nf90_put_var(ftn,varid,gtmp1,(/1,1,i/),&
(/LIS_rc%obs_gnc(k),LIS_rc%obs_gnr(k),1/))
call LIS_verify(ierr,'nf90_put_var failed in LIS_historyMod')
#endif

Expand Down
26 changes: 26 additions & 0 deletions lis/core/LIS_histDataMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ module LIS_histDataMod
public :: LIS_MOC_RTM_EMISSIVITY
public :: LIS_MOC_RTM_TB
public :: LIS_MOC_RTM_SM
public :: LIS_MOC_RTM_Sig0VV
public :: LIS_MOC_RTM_Sig0VH
! Irrigation
public :: LIS_MOC_IRRIGATEDWATER

Expand Down Expand Up @@ -802,6 +804,8 @@ module LIS_histDataMod
integer :: LIS_MOC_RTM_EMISSIVITY = -9999
integer :: LIS_MOC_RTM_TB = -9999
integer :: LIS_MOC_RTM_SM = -9999
integer :: LIS_MOC_RTM_Sig0VV = -9999
integer :: LIS_MOC_RTM_Sig0VH = -9999

integer :: LIS_MOC_IRRIGATEDWATER

Expand Down Expand Up @@ -4279,6 +4283,28 @@ subroutine LIS_histDataInit(n, ntiles)
n,1,ntiles,(/"m3/m3"/),1,(/"-"/),1,1,1)
endif

call ESMF_ConfigFindLabel(modelSpecConfig,"RTM Sig0VV:",rc=rc)
call get_moc_attributes(modelSpecConfig, LIS_histData(n)%head_rtm_list,&
"RTM_Sig0VV",&
"rtm_Sigma0_VV",&
"rtm Sigma0 VV",rc)
if ( rc == 1 ) then
call register_dataEntry(LIS_MOC_RTM_COUNT,LIS_MOC_RTM_Sig0VV,&
LIS_histData(n)%head_rtm_list,&
n,1,ntiles,(/"dB"/),1,(/"-"/),1,1,1)
endif

call ESMF_ConfigFindLabel(modelSpecConfig,"RTM Sig0VH:",rc=rc)
call get_moc_attributes(modelSpecConfig, LIS_histData(n)%head_rtm_list,&
"RTM_Sig0VH",&
"rtm_Sigma0_VH",&
"rtm Sigma0 VH",rc)
if ( rc == 1 ) then
call register_dataEntry(LIS_MOC_RTM_COUNT,LIS_MOC_RTM_Sig0VH,&
LIS_histData(n)%head_rtm_list,&
n,1,ntiles,(/"dB"/),1,(/"-"/),1,1,1)
endif

call ESMF_ConfigFindLabel(modelSpecConfig,"Irrigated water:",rc=rc)
call get_moc_attributes(modelSpecConfig, LIS_histData(n)%head_irrig_list, &
"IrrigatedWater",&
Expand Down
4 changes: 2 additions & 2 deletions lis/core/LIS_historyMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -8720,7 +8720,7 @@ subroutine stats(var,udef,ntiles,mean,stdev,min,max)
max=-100000.
count1 = 0
do t=1,ntiles
if(var(t).ne.udef)then
if(.not.isNaN(var(t)).and. var(t).ne.udef)then
count1 = count1 +1
vsum=vsum+var(t)
if(var(t).gt.max)max=var(t)
Expand Down Expand Up @@ -8854,7 +8854,7 @@ subroutine stats_da(var,udef,ntiles,mean,spread, stdev,min,max)
max=-100000.
count1 = 0
do t=1,ntiles
if(var(t).ne.udef)then
if(.not.isNaN(var(t)).and. var(t).ne.udef)then
count1 = count1 +1
vsum=vsum+var(t)
if(var(t).gt.max)max=var(t)
Expand Down
22 changes: 15 additions & 7 deletions lis/dataassim/algorithm/enkf/enkf_Mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ module enkf_Mod
!
! !REVISION HISTORY:
! 27 Feb 2005: Sujay Kumar; Initial Specification
!
! 30 Jun 2022: Michel Bechtold (MB); Enabling multiple observation types
! 30 Jun 2022: Zdenko Heyaert, Michel Bechtold; bug fix for multiple DA instances

! !USES:
use ESMF
use enkf_types
Expand Down Expand Up @@ -736,9 +738,10 @@ subroutine writeInnovationOutput(n,k)
call LIS_verify(nf90_def_dim(ftn,&
vardimname,LIS_rc%nobtypes(k),dimId(3)),&
'nf90_def_dim failed for ninnov_'//trim(finst))
!MB add third dimension for multiple obstypes
call LIS_verify(nf90_def_var(ftn,varname,&
nf90_float,&
dimids = dimID(1:2), varID=ninnov_Id),&
dimids = dimID(1:3), varID=ninnov_Id),&
'nf90_def_var failed for '//trim(varname)//' in enkf_mod')

#if(defined USE_NETCDF4)
Expand All @@ -763,9 +766,10 @@ subroutine writeInnovationOutput(n,k)
vardimname,LIS_rc%nobtypes(k),dimId(3)),&
'nf90_def_dim failed for innov_'//trim(finst))

!MB add third dimension for multiple obstypes
call LIS_verify(nf90_def_var(ftn,varname,&
nf90_float,&
dimids = dimID(1:2), varID=innov_Id),&
dimids = dimID(1:3), varID=innov_Id),&
'nf90_def_var failed for innov')

#if(defined USE_NETCDF4)
Expand All @@ -791,9 +795,10 @@ subroutine writeInnovationOutput(n,k)
vardimname,LIS_rc%nobtypes(k),dimId(3)),&
'nf90_def_dim failed for analysis_residual_'//trim(finst))

!MB add third dimension for multiple obstypes
call LIS_verify(nf90_def_var(ftn,varname,&
nf90_float,&
dimids = dimID(1:2), varID=ares_Id),&
dimids = dimID(1:3), varID=ares_Id),&
'nf90_def_var failed for '//trim(varname)//' in enkf_mod')

#if(defined USE_NETCDF4)
Expand All @@ -818,9 +823,10 @@ subroutine writeInnovationOutput(n,k)
vardimname,LIS_rc%nobtypes(k),dimId(3)),&
'nf90_def_dim failed for forecast_sigma_'//trim(finst))

!MB add third dimension for multiple obstypes
call LIS_verify(nf90_def_var(ftn,varname,&
nf90_float,&
dimids = dimID(1:2), varID=forecast_sigma_Id),&
dimids = dimID(1:3), varID=forecast_sigma_Id),&
'nf90_def_var for forecast_sigma failed in enkf_mod')

#if(defined USE_NETCDF4)
Expand Down Expand Up @@ -985,7 +991,8 @@ subroutine writeEnsembleSpread(n,k)
LIS_rc%nstvars(k),state_size, stvar)

do v=1,LIS_rc%nstvars(k)
call LIS_writevar_spread(ftn,n,k,ensspread_id(v), &
! MB: bug fix for multiple DA instances
call LIS_writevar_spread(ftn,n,LIS_rc%lsm_index,ensspread_id(v), &
stvar(v,:),v)
enddo

Expand Down Expand Up @@ -1117,7 +1124,8 @@ subroutine writeAnalysisIncr(n,k)
endif

do v=1,LIS_rc%nstvars(k)
call LIS_writevar_incr(ftn,n,k,incr_id(v), &
! MB: bug fix for multiple DA instances
call LIS_writevar_incr(ftn,n,LIS_rc%lsm_index,incr_id(v), &
enkf_struc(n,k)%anlys_incr(v,:),v)
enddo

Expand Down
Loading