[ncl-talk] Adding two arrays - with missing values in different rows and columns

JETAL SUTARIYA jetal164 at email.arizona.edu
Sat Apr 2 13:07:12 MDT 2022


 Hi NCL user community,

I am trying to add two arrays: SMAP soil moisture L3 am and pm arrays, to
obtain total soil moisture.
Soil moisture total(var5) is var3+var4 but when there are missing values in
either of those arrays, then var5 is also having missing values. Instead, I
want to use sm_pm(var4) when sm_am(var3) is having missing values and if
sm_pm(var4) is having missing values then use sm_am(var3), and when both
are having nonmissing values then sum them. I guess NCL does not

I use below code but var5 is solved for line 3 of the code rather than both
the line 3 and line 4, so where var4 is missing it does not use var3 value:
 var3 = sm_am(x,:,:) ;sm_am = soil moisture am data x = time dimension
 var4 = sm_pm(x,:,:) ;sm_pm = soil moisture pm data x = time dimension
 var5 = where(ismissing(var3), var4, var3+var4)
 var5 = where(ismissing(var4), var3, var3+var4)

Please suggest a way to get the correct total soil moisture array such that
these conditions are satisfied.

I appreciate your help in finding a solution.

Thank you,
Jetal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20220402/1da7adbc/attachment.html>


More information about the ncl-talk mailing list