Skip to content

Commit 469c5da

Browse files
authored
Merge pull request #214 from olyson/master
Backwards compatibility for model versions that don't have NPP_NUPTAKE
2 parents bcaa6d7 + 0f4bf3d commit 469c5da

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

lnd_diag/model1-model2/set_1.ncl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ trendsFlag = stringtointeger(getenv("trends_match_Flag"))
247247
if (isvar("x")) then
248248
delete(x)
249249
end if
250+
data(m,:) = data@_FillValue
250251
plot_check = False
251252
continue
252253
end if

lnd_diag/shared/lnd_func.ncl

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -505,14 +505,19 @@ begin
505505

506506
if(var_name.eq."NUPTAKE_FRACTION")then
507507
npp = ptr ->NPP
508-
npp_nuptake = ptr ->NPP_NUPTAKE
508+
if (isfilevar(ptr,"NPP_NUPTAKE")) then
509+
npp_nuptake = ptr ->NPP_NUPTAKE
509510

510-
var = npp ; trick to retain meta data
511-
nuptake_npp = npp_nuptake + npp
512-
if (any(nuptake_npp .eq. 0)) then ; set zeros to _FillValue
513-
nuptake_npp = mask(nuptake_npp,(nuptake_npp .eq. 0),False)
511+
var = npp ; trick to retain meta data
512+
nuptake_npp = npp_nuptake + npp
513+
if (any(nuptake_npp .eq. 0)) then ; set zeros to _FillValue
514+
nuptake_npp = mask(nuptake_npp,(nuptake_npp .eq. 0),False)
515+
end if
516+
var = npp_nuptake/nuptake_npp
517+
else
518+
var = npp
519+
var = var@_FillValue
514520
end if
515-
var = npp_nuptake/nuptake_npp
516521
return(var)
517522
end if
518523

0 commit comments

Comments
 (0)