<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Indeed!  The following code solved the issue:<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
    if(.not.isatt(wetland_CH4_emissions_ens,"_FillValue")) then
<div>      wetland_CH4_emissions_ens@_FillValue = default_fillvalue(typeof(wetland_CH4_emissions_ens))</div>
<div>    end if</div>
<div>;    replace_ieeenan (wetland_CH4_emissions_ens, wetland_CH4_emissions_ens@_FillValue, 0); lead to values over Ocean</div>
<div>    replace_ieeenan (wetland_CH4_emissions_ens, 0.0, 0)</div>
<div><br>
</div>
Xiao-Ming Hu <br>
</div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Adam Phillips <asphilli@ucar.edu><br>
<b>Sent:</b> Friday, April 23, 2021 1:05 PM<br>
<b>To:</b> xiaoming Hu <yuanfangcan@hotmail.com><br>
<b>Cc:</b> Dennis Shea <shea@ucar.edu>; ncl-talk@ucar.edu <ncl-talk@ucar.edu>; Xiaoming Hu <xhu@ou.edu><br>
<b>Subject:</b> Re: [ncl-talk] all nan after dim_avg_n_Wrap</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>Hi Xiaoming,</div>
NaN's are likely present in your wetland_CH4_emissions_ens array. You can use isnan_ieee/replace_ieeenan to fix that:
<div><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/isnan_ieee.shtml">https://www.ncl.ucar.edu/Document/Functions/Built-in/isnan_ieee.shtml</a></div>
<div>Adam</div>
<div><br>
</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Fri, Apr 23, 2021 at 11:01 AM xiaoming Hu via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu">ncl-talk@mailman.ucar.edu</a>> wrote:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
4-dimension array summary is actually before applying dim_avg_n_Wrap<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
See more detailed diagnose, code: <br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
  printVarSummary(wetland_CH4_emissions_ens)
<div>  printMinMax(wetland_CH4_emissions_ens,0)</div>
  wetland_CH4_emissions = dim_avg_n_Wrap(wetland_CH4_emissions_ens,0) ; [model | 18] x [time | 228] x [lat | 360] x [lon | 720]
<div>  print("got ensembe everage")</div>
<div>      printMinMax(wetland_CH4_emissions,0)</div>
<div>  printVarSummary(wetland_CH4_emissions)</div>
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Output:</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Variable: wetland_CH4_emissions_ens
<div>Type: double</div>
<div>Total Size: 8510054400 bytes</div>
<div>            1063756800 values</div>
<div>Number of Dimensions: 4</div>
<div>Dimensions and sizes: [model | 18] x [time | 228] x [lat | 360] x [lon | 720]</div>
<div>Coordinates: </div>
<div>            model: [1913..3934]</div>
<div>            time: [   1.. 228]</div>
<div>Number Of Attributes: 1</div>
<div>  units : mg CH4 m-2 day-1</div>
<div>(0) min=-0   max=535.915259495705</div>
<div>(0) got ensembe everage</div>
<div>(0) min=-nan   max=-nan</div>
<div><br>
</div>
<div>Variable: wetland_CH4_emissions</div>
<div>Type: double</div>
<div>Total Size: 472780800 bytes</div>
<div>            59097600 values</div>
<div>Number of Dimensions: 3</div>
<div>Dimensions and sizes: [time | 228] x [lat | 360] x [lon | 720]</div>
<div>Coordinates: </div>
<div>            time: [   1.. 228]</div>
<div>Number Of Attributes: 2</div>
<div>  units : mg CH4 m-2 day-1</div>
<div>  average_op_ncl : dim_avg_n over dimension(s): model</div>
<br>
</div>
<div id="x_gmail-m_2290904745110384921appendonsend"></div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<hr style="display:inline-block; width:98%">
<div id="x_gmail-m_2290904745110384921divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>><br>
<b>Sent:</b> Friday, April 23, 2021 11:53 AM<br>
<b>To:</b> xiaoming Hu <<a href="mailto:yuanfangcan@hotmail.com" target="_blank">yuanfangcan@hotmail.com</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] all nan after dim_avg_n_Wrap</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>The source array is:  [model | 18] x [time | 228] x [lat | 360] x [lon | 720]</div>
<div><br>
</div>
<div>The output array from:<br>
</div>
<div><br>
</div>
<div>wetland_CH4_emissions = dim_avg_n_Wrap(wetland_CH4_emissions_ens,0)</div>
<div><br>
</div>
<div>should be 3-dimensions: [time | 228] x [lat | 360] x [lon | 720]</div>
<div><br>
</div>
<div>You show 4-dimensions.<br>
</div>
<br>
</div>
<br>
<div>
<div dir="ltr">On Fri, Apr 23, 2021 at 10:07 AM xiaoming Hu via ncl-talk <<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a>> wrote:<br>
</div>
<blockquote style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
I have used dim_avg_n_Wrap for a long time and never had issues. But today it led to all nan, any idea? Thanks,<br>
xiaoming<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
See my code:   <br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
  printVarSummary(wetland_CH4_emissions_ens)
<div>  printMinMax(wetland_CH4_emissions_ens,0)</div>
  wetland_CH4_emissions = dim_avg_n_Wrap(wetland_CH4_emissions_ens,0) ; [model | 18] x [time | 228] x [lat | 360] x [lon | 720]
<div>  print("got ensembe everage")</div>
<div>      printMinMax(wetland_CH4_emissions,0)</div>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
and output: <br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
Variable: wetland_CH4_emissions_ens
<div>Type: double</div>
<div>Total Size: 8510054400 bytes</div>
<div>            1063756800 values</div>
<div>Number of Dimensions: 4</div>
<div>Dimensions and sizes: [model | 18] x [time | 228] x [lat | 360] x [lon | 720]</div>
<div>Coordinates: </div>
<div>            model: [1913..3934]</div>
<div>            time: [   1.. 228]</div>
<div>Number Of Attributes: 1</div>
<div>  units : mg CH4 m-2 day-1</div>
<div>(0) min=-0   max=535.915259495705</div>
<div>(0) got ensembe everage</div>
<div>(0) min=-nan   max=-nan</div>
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
</div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote>
</div>
</div>
</div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@mailman.ucar.edu" target="_blank">ncl-talk@mailman.ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="https://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">https://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr" class="x_gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div>
<div><span><font color="#888888">Adam Phillips <br>
</font></span></div>
<span><font color="#888888">Associate Scientist,  </font></span><span><font color="#888888">Climate and Global Dynamics Laboratory, NCAR<br>
</font></span></div>
</div>
<div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a>  
</font></span><span><font color="#888888">303-497-1726 </font></span></div>
<span><font color="#888888"></font></span>
<div>
<div><span><font color="#888888"><br>
</font></span>
<div><span><font color="#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli" target="_blank"></a></font></span></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>