<div dir="ltr"><div><div><div>Hi Efren,<br></div>I think, the issue is that both variables have only 1 time step, So what would be correlation if non of variables is changing in time?<br><br></div>Cheers,<br></div>Rashed<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jan 13, 2018 at 10:13 AM, Efren Lopez Blanco via ncl-talk <span dir="ltr"><<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="white" link="blue" vlink="purple" lang="EN-GB">
<div class="m_-3502721952486621447WordSection1">
<p class="MsoNormal"><span>Hi Rick,<u></u><u></u></span></p>
<p class="MsoNormal"><span><br>
Thanks for the answer, I thought also about the differences between missing values and fill values. I tested your suggestion, and the result was the same. Since I am dealing with doubles, I standardized both (missing values and fill values) to -9999. Quick
and dirty, but in order to make sure both attributes are the same, I performed:<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span>cveg_HWSD_b_avg_3d@_FillValue = -9999
<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span>cveg_HWSD_b_avg_3d@missing_<wbr>value = -9999
<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span>lpjml_hadgem2_es_avg_mask_3d@_<wbr>FillValue = -9999
<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span>lpjml_hadgem2_es_avg_mask_3d@<wbr>missing_value = -9999
<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span><u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span>cveg_HWSD_b_avg_3d@_FillValue = cveg_HWSD_b_avg_3d@missing_<wbr>value<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span>lpjml_hadgem2_es_avg_mask_3d@_<wbr>FillValue = lpjml_hadgem2_es_avg_mask_3d@<wbr>missing_value<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span><u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span>delete(cveg_HWSD_b_avg_3d@<wbr>missing_value) ; not necessary, just cleaning up<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span>delete(lpjml_hadgem2_es_avg_<wbr>mask_3d@missing_value) ; not necessary, just cleaning up<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>This resulted in:<u></u><u></u></span></p><span class="">
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span>Variable: cveg_HWSD_b_avg_3d<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span>Type: double<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span>Total Size: 106560 bytes<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span> 13320 values<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span>Number of Dimensions: 3<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span>Dimensions and sizes: [time | 1] x [lat | 37] x [lon | 360]<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span>Coordinates:<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span> time: [1..1]<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span> lat: [79.5..43.5]<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span> lon: [-179.5..179.5]<u></u><u></u></span></p>
</span><p class="MsoNormal" style="margin-left:.5in"><span>Number Of Attributes: 5<u></u><u></u></span></p><span class="">
<p class="MsoNormal" style="margin-left:.5in"><span> average_op_ncl : dim_avg_n over dimension(s): time<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span> units : g C m-2<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span> long_name : C stored in Cveg<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span> percentile : 50<u></u><u></u></span></p>
</span><p class="MsoNormal" style="margin-left:.5in"><span> _FillValue : -9999<u></u><u></u></span></p><span class="">
<p class="MsoNormal" style="margin-left:.5in"><span>(0) C stored in Cveg: min=0.1382737806910972 max=12.84650588106167<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span><u></u> <u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span>Variable: lpjml_hadgem2_es_avg_mask_3d<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span>Type: double<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span>Total Size: 106560 bytes<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span> 13320 values<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span>Number of Dimensions: 3<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span>Dimensions and sizes: [time | 1] x [lat | 37] x [lon | 360]<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span>Coordinates:<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span> time: [1..1]<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span> lat: [79.5..43.5]<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span> lon: [-179.5..179.5]<u></u><u></u></span></p>
</span><p class="MsoNormal" style="margin-left:.5in"><span>Number Of Attributes: 5<u></u><u></u></span></p><span class="">
<p class="MsoNormal" style="margin-left:.5in"><span> units : kg m-2<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span> long_name : Carbon Mass in Vegetation<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span> standard_name : vegetation_carbon_content<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span> average_op_ncl : dim_avg_n over dimension(s): time<u></u><u></u></span></p>
</span><p class="MsoNormal" style="margin-left:.5in"><span> _FillValue : -9999<u></u><u></u></span></p><span class="">
<p class="MsoNormal" style="margin-left:.5in"><span>(0) Carbon Mass in Vegetation: min=3.493304393487051e-05 max=15.10204410552979<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in"><span><u></u> <u></u></span></p>
</span><p class="MsoNormal"><span>And then the escorc_n function [lpjml_r = escorc_n(cveg_HWSD_b_avg_3d,<wbr>lpjml_hadgem2_es_avg_mask_3d, 0, 0)], which again has resulted in min=-9999 max=-9999. The issue is clearly in the escorc_n
function.<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<p class="MsoNormal"><span>Best,<u></u><u></u></span></p>
<p class="MsoNormal"><span>Efren<u></u><u></u></span></p>
<p class="MsoNormal"><span><u></u> <u></u></span></p>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">Rick Brownrigg <<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>><br>
<b>Date: </b>Saturday, 13 January 2018 at 16.49<br>
<b>To: </b>Efren Lopez Blanco <<a href="mailto:elb@bios.au.dk" target="_blank">elb@bios.au.dk</a>><br>
<b>Cc: </b>"<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>" <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br>
<b>Subject: </b>Re: [ncl-talk] Computing coefficient of determination with gridded datasets<u></u><u></u></span></p>
</div><div><div class="h5">
<div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">Pure speculation on my part, but I notice that both variables have different values for their missing_value vs. _FillValue attributes. I wonder which value actually occurs in the data? I *think* if both are
present as attributes, NCL will honor the _FillValue value, and then values of missing_value get treated as data (?) Something to perhaps check out.<u></u><u></u></p>
</div>
<p class="MsoNormal">Rick<u></u><u></u></p>
</div>
<div>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Sat, Jan 13, 2018 at 3:21 AM, Efren Lopez Blanco via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal">Hi there,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I would like to compute the coefficient of determination (r squared) between 2 gridded datasets of the form (time,lat,lon). In order to do so, I aim to apply the escorc_n function.
The two datasets I am using look like:<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Variable: <b>cveg_HWSD_b_avg_3d</b><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Type: double<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Total Size: 106560 bytes<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
13320 values<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Number of Dimensions: 3<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Dimensions and sizes: [time | 1] x [lat | 37] x [lon | 360]<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Coordinates:<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
time: [1..1]<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
lat: [79.5..43.5]<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
lon: [-179.5..179.5]<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Number Of Attributes: 6<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
average_op_ncl : dim_avg_n over dimension(s): time<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
missing_value : -9999<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
units : g C m-2<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
long_name : C stored in Cveg<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
percentile : 50<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
_FillValue : 1.000000020040877e+20<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
(0) C stored in Cveg: min=0.1382737806910972 max=12.84650588106167<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Variable: <b>lpjml_hadgem2_es_avg_mask_3d</b><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Type: double<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Total Size: 106560 bytes<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
13320 values<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Number of Dimensions: 3<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Dimensions and sizes: [time | 1] x [lat | 37] x [lon | 360]<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Coordinates:<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
time: [1..1]<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
lat: [79.5..43.5]<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
lon: [-179.5..179.5]<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Number Of Attributes: 6<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
units : kg m-2<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
long_name : Carbon Mass in Vegetation<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
standard_name : vegetation_carbon_content<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
average_op_ncl : dim_avg_n over dimension(s): time<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
missing_value : 1e+20<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
_FillValue : 1.000000020040877e+20<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
(0) Carbon Mass in Vegetation: min=3.493304393487051e-05 max=15.10204410552979<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Then I apply the function:<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal" style="text-indent:.5in">
lpjml_r = escorc_n(cveg_HWSD_b_avg_3d,<wbr>lpjml_hadgem2_es_avg_mask_3d, 0, 0) ; r(nlat,mlon)<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">However, I’ve noticed the output only contain NAs:
<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Variable: <b>lpjml_r</b><u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Type: double<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Total Size: 106560 bytes<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
13320 values<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Number of Dimensions: 2<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Dimensions and sizes: [lat | 37] x [lon | 360]<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Coordinates:<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
lat: [79.5..43.5]<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
lon: [-179.5..179.5]<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
Number Of Attributes: 6<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
missing_value : -9999<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
average_op_ncl : dim_avg_n over dimension(s): time<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
units : g C m-2<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
long_name : C stored in Cveg<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
percentile : 50<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
_FillValue : 1.000000020040877e+20<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.5in">
(0) C stored in Cveg: min=1.000000020040877e+20 max=1.000000020040877e+20<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Am I doing something wrong? I’ve also tried to convert from double to float.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Best,<u></u><u></u></p>
<p class="MsoNormal">Efren<u></u><u></u></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
</div>
</div></div></div>
</div>
<br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>