Skip to content

Commit

Permalink
Merge pull request #214 from olyson/master
Browse files Browse the repository at this point in the history
Backwards compatibility for model versions that don't have NPP_NUPTAKE
  • Loading branch information
bertinia authored Nov 4, 2019
2 parents bcaa6d7 + 0f4bf3d commit 469c5da
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions lnd_diag/model1-model2/set_1.ncl
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ trendsFlag = stringtointeger(getenv("trends_match_Flag"))
if (isvar("x")) then
delete(x)
end if
data(m,:) = data@_FillValue
plot_check = False
continue
end if
Expand Down
17 changes: 11 additions & 6 deletions lnd_diag/shared/lnd_func.ncl
Original file line number Diff line number Diff line change
Expand Up @@ -505,14 +505,19 @@ begin

if(var_name.eq."NUPTAKE_FRACTION")then
npp = ptr ->NPP
npp_nuptake = ptr ->NPP_NUPTAKE
if (isfilevar(ptr,"NPP_NUPTAKE")) then
npp_nuptake = ptr ->NPP_NUPTAKE

var = npp ; trick to retain meta data
nuptake_npp = npp_nuptake + npp
if (any(nuptake_npp .eq. 0)) then ; set zeros to _FillValue
nuptake_npp = mask(nuptake_npp,(nuptake_npp .eq. 0),False)
var = npp ; trick to retain meta data
nuptake_npp = npp_nuptake + npp
if (any(nuptake_npp .eq. 0)) then ; set zeros to _FillValue
nuptake_npp = mask(nuptake_npp,(nuptake_npp .eq. 0),False)
end if
var = npp_nuptake/nuptake_npp
else
var = npp
var = var@_FillValue
end if
var = npp_nuptake/nuptake_npp
return(var)
end if

Expand Down

0 comments on commit 469c5da

Please sign in to comment.