Commit 005382b2 authored by ronesy's avatar ronesy
Browse files

Correction to read NEE regional fields and change to GHG flux error calculation

parent 3253b68a
......@@ -390,7 +390,9 @@ subroutine init_co2(files, config, fluxes, obs, states, covar)
jd = juldatei
nd = 1
do while ( (jd.le.juldatef).and.(nd.le.ntstate) )
! RLT Dec-2018
! do while ( (jd.le.juldatef).and.(nd.le.ntstate) )
do while ( (jd.le.(juldatef-dble(statres)+1d0)).and.(nd.le.ntstate) )
reg_flx(:,:,:) = 0.
call caldate(jd, jjjjmmdd, hhmiss)
......@@ -399,6 +401,7 @@ subroutine init_co2(files, config, fluxes, obs, states, covar)
! read NEE fluxes for current day (starting from 00:00)
filename = str_replace(files%filenest_nee, 'YYYY', adate)
filename = trim(files%path_prior)//trim(filename)
print*, filename
inquire(file=trim(filename),exist=lexist)
if (.not.lexist) then
write(logid,*) 'ERROR: cannot find '//trim(filename)
......@@ -411,8 +414,11 @@ subroutine init_co2(files, config, fluxes, obs, states, covar)
files%timenest_nee,&
rllx, rlly, &
nxregrid, nyregrid, &
jd, int(statres)*nd_nee, num, &
(jd+1d0/dble(2*nd_nee)), int(statres)*nd_nee, num,&
reg_flx)
! RLT Dec-2018
! jd, int(statres)*nd_nee, num, &
! reg_flx)
! check if everything read
if ( num.ne.int(statres)*nd_nee ) then
jdi = jd + num/nd_nee
......@@ -436,8 +442,11 @@ subroutine init_co2(files, config, fluxes, obs, states, covar)
files%timenest_nee,&
rllx, rlly, &
nxregrid, nyregrid, &
jdi, nread, num, &
(jdi+1d0/dble(2*nd_nee)), nread, num, &
flx)
! RLT Dec-2018
! jdi, nread, num, &
! flx)
reg_flx(:,:,int(statres)*nd_nee-nread+1:int(statres)*nd_nee) = flx(:,:,:)
deallocate( flx )
endif
......
......@@ -230,17 +230,17 @@ subroutine init_ghg(files, config, fluxes, obs, states, covar)
if ( (nbox_xy(ix,jy).gt.0).and.(lsm(ix,jy).ge.0.01) ) then
! land box -> error is proportional to flux
err_box(nbox_xy(ix,jy),n) = err_box(nbox_xy(ix,jy),n) + &
(abs(flx(ix0+ix-1,jy0+jy-1,n)) * config%flxerr * area)**2
flx(ix0+ix-1,jy0+jy-1,n) * config%flxerr * area
else if ( config%inc_ocean ) then
! ocean box -> error is proportional to flux
err_box(nbox_xy(ix,jy),n) = err_box(nbox_xy(ix,jy),n) + &
(abs(flx(ix0+ix-1,jy0+jy-1,n)) * config%flxerr * area)**2
flx(ix0+ix-1,jy0+jy-1,n) * config%flxerr * area
endif
end do
end do
flx_box(:,n) = flx_box(:,n)/area_box
if ( nocn.gt.0 ) fluxes%ocn_box(:,n) = fluxes%ocn_box(:,n)/area_ocn
err_box(:,n) = sqrt(err_box(:,n))/area_box
err_box(:,n) = err_box(:,n)/area_box
end do
! set minimum error
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment