<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Dennis,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">I have been going thru the code trying to attempt to solve why the binned values for the for a given point plot between 0 and 110 based on the plot scale. This file that I am working with only has 4 swaths. Shouldn't
the scale only go from 0 to 4 (if binning the total number of points with measured AOD values that have been replaced with 1 for valid data and 0 for invalid data) in that case given that the maximum number of times a given 1km x 1km point is sampled?</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Thanks,</p>
<p style="margin-top:0;margin-bottom:0">Jason<br>
</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Dennis Shea <shea@ucar.edu><br>
<b>Sent:</b> Monday, July 15, 2019 2:05:36 PM<br>
<b>To:</b> Herb, Jason<br>
<b>Cc:</b> ncl-talk@ucar.edu<br>
<b>Subject:</b> Re: [ncl-talk] Replacement of data with a constant value</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>As noted in a previous ncl-talk question, the most important rule of data processing is "look at your data".
<br>
</div>
<div>This is user responsibility.</div>
<div><br>
</div>
<div>+++ ON THE HDF FILE</div>
<div> <b>short </b>Optical_Depth_047_grid1km ( Orbits_grid1km, YDim_grid1km, XDim_grid1km )<br>
coordinates : GridLat_grid1km, GridLon_grid1km<br>
hdfeos_name : Optical_Depth_047<br>
projection : Sinusoidal<br>
<b> valid_range : ( -100, 5000 ) ;<span style="color:rgb(0,0,255)"> these pertain to the "short" numerical type</span><br>
_FillValue : -28672 <span style="color:rgb(0,0,255)">; type "short"</span></b><br>
unit : none<br>
<span style="color:rgb(255,0,0)"><b> add_offset : 0<br>
scale_factor : 0.001</b></span><br>
long_name : AOD at 0.47 micron</div>
<div><br>
</div>
<div>+++ AFTER unpacking via <b>short2flt, the</b></div>
<div><b><br>
</b></div>
<div><b>V</b>ariable: x <=== Optical_Depth_047_grid1km <br>
Type:<b> float</b><br>
[SNIP]<br>
long_name : AOD at 0.47 micron<br>
</div>
<div>[snip] <br>
</div>
<div> _FillValue : -28672 <span style="color:rgb(0,0,255)"><b><== these are now type float</b></span><br>
<b> valid_range : ( -0.1, 5 ) <span style="color:rgb(0,0,255)"><b><== these are now type float in the unpacked range<br>
</b></span></b></div>
<div><br>
</div>
<div>Some code to add to your script.<br>
</div>
<div><br>
</div>
<div> f0 = <b>addfile</b>(diri+fili(0)+".he2", "r") ; .he2 causes NCL to add lat/lon arrays
<br>
x = <span style="color:rgb(0,0,255)"><b>short2flt</b></span>( f0->$vNam$ ) ; ( Orbits_grid1km, YDim_grid1km, XDim_grid1km )<br>
<br>
<b>printVarSummary</b>(x)<br>
<b>printMinMax</b>(x,0)<br>
print("=============================")<br>
nmsg = <b>num(ismissing</b>(x))<br>
ngood= <b>num</b>(<b><span style="color:rgb(255,0,0)">.not.</span>ismissing</b>(x))<br>
npts = nmsg+ngood<br>
npc = (ngood/<b>tofloat</b>(npts))*100<br>
print("nmsg ="+nmsg)<br>
print("ngood="+ngood)<br>
print("npc (%)="+npc)<br>
print("=============================")<br>
<br>
; *****************************************************************<br>
nx = num(<a href="http://x.ge">x.ge</a>. -0.1 .and. x.le.5.0) ; values after unpacking<br>
; within allowed range<br>
print("nx="+nx+": this should match ngood="+ngood) ; ie: there are no out of range values<br>
X01 = where(<a href="http://x.ge">x.ge</a>. -0.1 .and. x.le.5.0, 1, 0) <br>
printVarSummary(X01) <br>
n1n = num(X01.eq.1)<br>
n1s = sum(X01)<br>
print("n1n="+n1n+" n1s="+n1s)<br>
print("=============================")<br>
</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr" class="x_gmail_attr">On Mon, Jul 15, 2019 at 10:27 AM Herb, Jason <<a href="mailto:jherb@albany.edu">jherb@albany.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 id="x_gmail-m_6973061338406197934divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0px; margin-bottom:0px">Dennis,</p>
<p style="margin-top:0px; margin-bottom:0px"><br>
</p>
<p style="margin-top:0px; margin-bottom:0px">I have attempted to make the suggested changes and received even more errors despite creating an additional variable..... errors can be found below below. I have attached full code and the file that I am working
with to get the plot.</p>
<p style="margin-top:0px; margin-bottom:0px"><br>
</p>
<p style="margin-top:0px; margin-bottom:0px"></p>
<div> Copyright (C) 1995-2017 - All Rights Reserved<br>
University Corporation for Atmospheric Research<br>
NCAR Command Language Version 6.4.0<br>
The use of this software is governed by a License Agreement.<br>
See <a href="http://www.ncl.ucar.edu/" target="_blank">http://www.ncl.ucar.edu/</a> for more details.<br>
(0) nfil=1<br>
fatal:Number of dimensions on right hand side do not match number of dimension in left hand side<br>
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 106 in file MCD19A2.Jason2.ncl<br>
<br>
fatal:syntax error: procedure bin_sum expects 7 arguments, got 8<br>
fatal:error at line 128 in file MCD19A2.Jason2.ncl<br>
<br>
fatal:Syntax Error in block, block not executed<br>
fatal:error at line 133 in file MCD19A2.Jason2.ncl<br>
<br>
(0)<br>
=====> Wall Clock Elapsed Time: Main Sum Loop: nlat=3600, mlon=7200: 0 seconds <=====<br>
<br>
fatal:Variable (f) is undefined<br>
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 151 in file MCD19A2.Jason2.ncl<br>
<br>
fatal:Variable (f) is undefined<br>
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 157 in file MCD19A2.Jason2.ncl<br>
<br>
fatal:syntax error: procedure gsn_panel expects 4 arguments, got 3<br>
fatal:error at line 215 in file MCD19A2.Jason2.ncl<br>
<br>
fatal:Syntax Error in block, block not executed<br>
fatal:error at line 217 in file MCD19A2.Jason2.ncl<br>
<br>
</div>
<br>
<p></p>
</div>
<hr style="display:inline-block; width:98%">
<div id="x_gmail-m_6973061338406197934divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Dennis Shea <<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>><br>
<b>Sent:</b> Monday, July 15, 2019 11:18:35 AM<br>
<b>To:</b> Herb, Jason<br>
<b>Cc:</b> <a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
<b>Subject:</b> Re: [ncl-talk] Replacement of data with a constant value</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml" target="_blank"><b>http://www.ncl.ucar.edu/Document/Functions/Built-in/where.shtml</b></a></div>
<div><a href="http://www.ncl.ucar.edu/Document/Functions/Built-in/num.shtml" target="_blank"><b>http://www.ncl.ucar.edu/Document/Functions/Built-in/num.shtml</b></a></div>
<div><br>
</div>
<div>I am not sure where you got the form you are using for '<b>where</b>'. <br>
</div>
<div>In no example is there an 'x=1' style for any of the arguments.</div>
<div><br>
</div>
<div>Also, given your description, I'm not sure that you want to use '<b>where'</b><br>
</div>
<div><br>
</div>
<div>x = <b>short2flt</b>( f->$vNam$ ) ; ( Orbits_grid1km, YDim_grid1km, XDim_grid1km )<br>
nx = <b>num</b>(x.gt.-100 .and. x.lt.5000) ; # of values bwtweem -100 and 5000<br>
</div>
<div>===</div>
<div><br>
</div>
<div>x01 = <b>where</b>(x.gt.-100 .and. x.lt.5000, 0, 1) ; create an array of 0 and 1<br>
</div>
<div>n1 = <b>num</b>(x.eq.1) ; also: <b>sum</b>(x)<br>
</div>
</div>
<br>
<div class="x_gmail-m_6973061338406197934x_gmail_quote">
<div dir="ltr" class="x_gmail-m_6973061338406197934x_gmail_attr">On Mon, Jul 15, 2019 at 8:24 AM Herb, Jason via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<br>
</div>
<blockquote class="x_gmail-m_6973061338406197934x_gmail_quote" style="margin:0px 0px 0px 0.8ex; border-left:1px solid rgb(204,204,204); padding-left:1ex">
<div dir="ltr">
<div id="x_gmail-m_6973061338406197934x_gmail-m_-1306245686675571092gmail-m_-7474457273243491077divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif">
<p style="margin-top:0px; margin-bottom:0px">Hello,</p>
<p style="margin-top:0px; margin-bottom:0px"><br>
</p>
<p style="margin-top:0px; margin-bottom:0px">I am working with the MCD19A2 data. In order to see the data extent for any given time period, 1 day, 1 month, 1 year, or any selected time period we need to assess.<span>I have a binning code to add the points,
however the points that are being added are the original AOD values in the hdf files.</span> In order to do this I am attempting to replace all data points in the hdf file to " 1 " if there is data that is within the range flag of the data file. I have attempted
to use the "where" function to make these replacements however I keep getting error bugs coming up. The portion of the script can be found below.</p>
<p style="margin-top:0px; margin-bottom:0px"><br>
</p>
<p style="margin-top:0px; margin-bottom:0px">Script error messages<br>
</p>
<p style="margin-top:0px; margin-bottom:0px"></p>
<div>fatal:syntax error: line 120 in file MCD19A2.Jason1.ncl before or near =<br>
x1 = where(x.gt.-100 .and. x.lt.5000, x =<br>
---------------------------------------------^<br>
<br>
fatal:Syntax Error in block, block not executed<br>
fatal:error at line 136 in file MCD19A2.Jason1.ncl<br>
<br>
(0)<br>
=====> Wall Clock Elapsed Time: Main Sum Loop: nlat=3600, mlon=7200: 0 seconds <=====<br>
<br>
fatal:Variable (f) is undefined<br>
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 154 in file MCD19A2.Jason1.ncl<br>
<br>
fatal:Variable (f) is undefined<br>
fatal:["Execute.c":8640]:Execute: Error occurred at or near line 159 in file MCD19A2.Jason1.ncl<br>
<br>
warning:ContourPlotInitialize: no valid values in scalar field; ContourPlot not possible:[errno=1101]<br>
warning:ContourPlotInitialize: no valid values in scalar field; ContourPlot not possible:[errno=1101]</div>
<div><br>
</div>
<div><br>
Script coding<br>
</div>
<div> tStrt = systemfunc("date") ; time the loop (wall clock)<br>
<br>
do nf=0,nfil-1 ; loop over all files<br>
print(nf+" "+fili(nf))<br>
f = addfile(diri+fili(nf)+".he2", "r") ; .he2 causes NCL to add lat/lon arrays<br>
; read data<br>
lat2d = f->GridLat_grid1km<br>
lon2d = f->GridLon_grid1km<br>
<br>
x = short2flt( f->$vNam$ ) ; ( Orbits_grid1km, YDim_grid1km, XDim_grid1km )<br>
;*************** attmeping to change any AOD data other then N/A to 1 to count up<br>
x1 = where(x.gt.-100 .and. x.lt.5000, x = 1)<br>
delete( x )<br>
x = x1<br>
<br>
</div>
Thank you for you time
<p></p>
<p style="margin-top:0px; margin-bottom:0px">Jason<br>
</p>
<p style="margin-top:0px; margin-bottom:0px"><br>
</p>
</div>
</div>
_______________________________________________<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" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a></blockquote>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</body>
</html>