<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif">Would probably be best to attach varcalc.ncl so we can see the whole script. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"> The edited code I sent back to you should not create those errors <b>if you have defined time somewhere</b>.  Otherwise there will have been an initial error saying that time was not defined, which then cascades down the code.  Previously, the code will have continued but with the empty arrays but doing effectively nothing. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif">Always start with the first error. </div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Oct 14, 2017 at 4:13 PM, Prashanth Bhalachandran <span dir="ltr"><<a href="mailto:prashanth.bhalachandran@gmail.com" target="_blank">prashanth.bhalachandran@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div style="word-wrap:break-word">Dear Alan, <div>Unfortunately, I get a series of fatal errors if I don’t define them apriori. </div><div><br></div><div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:Undefined identifier: (speed) is undefined, can't continue</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:["Execute.c":8640]:<wbr>Execute: Error occurred at or near line 32 in file varcalc.ncl</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:Undefined identifier: (latvals) is undefined, can't continue</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:["Execute.c":8640]:<wbr>Execute: Error occurred at or near line 33 in file varcalc.ncl</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:Undefined identifier: (lonvals) is undefined, can't continue</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:["Execute.c":8640]:<wbr>Execute: Error occurred at or near line 34 in file varcalc.ncl</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:Undefined identifier: (speed) is undefined, can't continue</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:["Execute.c":8640]:<wbr>Execute: Error occurred at or near line 36 in file varcalc.ncl</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:Undefined identifier: (coord) is undefined, can't continue</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:["Execute.c":8640]:<wbr>Execute: Error occurred at or near line 37 in file varcalc.ncl</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:Undefined identifier: (coord) is undefined, can't continue</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:["Execute.c":8640]:<wbr>Execute: Error occurred at or near line 38 in file varcalc.ncl</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:Variable (latvals) is undefined</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:["Execute.c":8640]:<wbr>Execute: Error occurred at or near line 42 in file varcalc.ncl</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:Undefined identifier: (wnout) is undefined, can't continue</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:["Execute.c":8640]:<wbr>Execute: Error occurred at or near line 43 in file varcalc.ncl</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:Undefined identifier: (wnout) is undefined, can't continue</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:["Execute.c":8640]:<wbr>Execute: Error occurred at or near line 44 in file varcalc.ncl</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:Variable (var0) is undefined</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:["Execute.c":8640]:<wbr>Execute: Error occurred at or near line 45 in file varcalc.ncl</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:Variable (var1) is undefined</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">fatal:["Execute.c":8640]:<wbr>Execute: Error occurred at or near line 46 in file varcalc.ncl</span></div><div><div class="h5"><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div><blockquote type="cite"><div>On Oct 14, 2017, at 12:44 PM, Alan Brammer <<a href="mailto:abrammer@albany.edu" target="_blank">abrammer@albany.edu</a>> wrote:</div><br class="m_1702101270116292477Apple-interchange-newline"><div><div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif"><font color="#0061ff" style="font-family:arial,sans-serif;font-size:12px">> I don’t know what my dimensions of </font><font color="#ff2600" style="font-family:arial,sans-serif;font-size:12px">wnout</font><font color="#0061ff" style="font-family:arial,sans-serif;font-size:12px"> will be. Will it be a </font><font color="#ff2600" style="font-family:arial,sans-serif;font-size:12px">251x251x73</font><font color="#0061ff" style="font-family:arial,sans-serif;font-size:12px"> array? </font><br></div><div class="gmail_default" style="font-family:verdana,sans-serif"><font color="#0061ff" style="font-family:arial,sans-serif;font-size:12px"><br></font></div>It will<div class="gmail_default" style="font-family:verdana,sans-serif;display:inline">​ be a list, there won't be array dimensions.  You do not need to define wnout before hand. </div><div><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline">likewise, you do not need to define ​var0 or var1 before hand.  </div></div><div><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline"><br></div></div><div><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline">e.g.</div></div><div><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline"><br></div></div><div><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline"><br></div></div><div><div class="gmail_default" style="font-family:verdana,sans-serif;display:inline"><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> a = addfile(filename,"r")</span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> u10 = a->u10</span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> v10 = a->v10</span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> slp = a->slp</span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">;;;;;;;;;;;;;;;;; Constants ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;</span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> R         = 6371 </span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> d2r       = atan(1.0)/45; Equivalent of pi/180 - 0.01745329</span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> r2d       = 1.0/d2r</span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> toknots   = 1.94384</span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> pi        = 3.14159</span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;</span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal">;; this section wasn't really needed</div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;</span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> slpsub    = slp(time,0,:,:) ; X is now a 2D array</span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> speed     = wind_speed(u10(time,0,:,:),v10<wbr>(time,0,:,:)) * toknots</span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> latvals   = u10&lat(0:800)</span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> lonvals   = u10&lon(0:809)</span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> coord        = center_find(speed(:,:),slpsub)<wbr> </span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> lat1         = coord[0]</span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> lon1         = coord[1]</span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">;;;;;;;;;;;;;; Find all variables here and store into allvars ;;;;;;;</span></div><span class="m_1702101270116292477m_5598048521643050020gmail-im" style="font-family:Monaco;font-size:12px"><div style="margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><font color="#ff2600"> wnout        = wn01(latvals,lonvals,lat1,lon1<wbr>,speed)   </font></span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><font color="#ff2600"> var0         = wnout[0] </font></span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><font color="#ff2600"> var1         = wnout[1]  </font></span></div><div style="margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;line-height:normal;min-height:16px">printVarSummary(var0)</div><div style="margin:0px;line-height:normal;min-height:16px">printVarSummary(var1)</div><div style="margin:0px;line-height:normal;min-height:16px"><br></div></span><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">;;;;;;;;;;;;;;;;;;;;;; Write to a netcdf file ;;;;;;;;;;;;;;;;;;</span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal;min-height:16px"><br><span style="font-variant-ligatures:no-common-ligatures"></span></div><div style="font-family:Monaco;font-size:12px;margin:0px;line-height:normal;min-height:16px">;;;;   I do not think the lines that were here will work. </div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Oct 14, 2017 at 10:26 AM, Prashanth Bhalachandran <span dir="ltr"><<a href="mailto:prashanth.bhalachandran@gmail.com" target="_blank">prashanth.bhalachandran@gmail<wbr>.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div style="word-wrap:break-word"><div style="margin:0px;font-size:12px;line-height:normal;background-color:rgb(255,255,255)"><font color="#3a88fe">Dear Marston, </font></div><div style="margin:0px;font-size:12px;line-height:normal;background-color:rgb(255,255,255)"><font color="#3a88fe">Thank you for your response. I will ensure that the missing values are the default ones from NCL. I hope my attaching the code will give you a little more context. </font></div><div style="margin:0px;font-size:12px;line-height:normal;background-color:rgb(255,255,255)"><font color="#3a88fe"><br></font></div><div style="margin:0px;font-size:12px;line-height:normal;background-color:rgb(255,255,255)"><font color="#3a88fe">My concern is this : If I am returning two arrays var0  and var01 (please see the red highlighted portions for array dimensions), how will I receive it in the main wrapper script? </font></div><div style="margin:0px;font-size:12px;line-height:normal;background-color:rgb(255,255,255)"><font color="#3a88fe"><br></font></div><div style="margin:0px;line-height:normal;background-color:rgb(255,255,255)"><font color="#3a88fe"><span style="font-size:12px">That is, if my var0 dimension is : </span></font><span style="color:rgb(255,38,0);font-family:Monaco;font-size:12px">(/251/) </span><span style="color:rgb(0,97,255);font-size:12px">and my var01 dimension is </span><span style="font-size:12px"><font color="#ff2600">(/251,73/)</font><font color="#0061ff">, and I return the variable from the function using </font></span><span style="font-size:12px"><font color="#ff2600">return([/var0,var01/])</font></span><span style="color:rgb(0,97,255);font-size:12px">, when I collect it in the wrapper script using </span><span style="color:rgb(0,97,255);font-size:12px"> </span></div><div style="margin:0px;line-height:normal;background-color:rgb(255,255,255)"><font color="#ff2600"><span style="font-size:12px">wnout</span><span style="font-size:12px">        </span><span style="font-size:12px">= wn01(latvals,lonvals,lat1,lon1<wbr>,speed), </span></font></div><div style="margin:0px;line-height:normal;background-color:rgb(255,255,255)"><span style="font-size:12px"><font color="#0061ff"><br></font></span></div><div style="margin:0px;line-height:normal;background-color:rgb(255,255,255)"><span style="font-size:12px"><font color="#0061ff">I don’t know what my dimensions of </font><font color="#ff2600">wnout</font><font color="#0061ff"> will be. Will it be a </font><font color="#ff2600">251x251x73</font><font color="#0061ff"> array? I do know that I want to extract it as: </font></span></div><span><div style="font-size:12px;margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><font color="#0061ff"> </font><font color="#ff2600">var0         = wnout[0] </font></span></div><div style="margin:0px;line-height:normal;background-color:rgb(255,255,255)"><font color="#ff2600"><span style="font-size:12px"> var1</span><span style="font-size:12px"> </span><span style="font-size:12px">       </span><span style="font-size:12px"> </span><span style="font-size:12px">= wnout[1]</span><span style="font-size:12px"> </span><span style="font-size:12px"> </span></font><span style="font-size:12px"><font color="#ff2600"> </font><font color="#0061ff"> </font></span></div><div style="margin:0px;line-height:normal;background-color:rgb(255,255,255)"><font color="#ff2600" face="Monaco"><span style="font-size:12px"> </span></font></div><div style="margin:0px;font-size:12px;line-height:normal;background-color:rgb(255,255,255)"><br></div></span><div style="margin:0px;font-size:12px;line-height:normal;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"><b><u>CODE</u></b><font color="#ff2600" style="font-family:Monaco"> </font></span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"><font color="#ff2600"><br></font></span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/contributed.ncl"</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> load "/scratch/lustreD/s/sbhalach/D<wbr>ATA/func_center.ncl"</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> load "/scratch/lustreD/s/sbhalach/D<wbr>ATA/func_rtheta.ncl"</span></div><div style="margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> a = addfile(filename,"r")</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> u10 = a->u10</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> v10 = a->v10</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> slp = a->slp</span></div><div style="margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">;;;;;;;;;;;;;;;;; Constants ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;</span></div><div style="margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> R         = 6371 </span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> d2r       = atan(1.0)/45; Equivalent of pi/180 - 0.01745329</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> r2d       = 1.0/d2r</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> toknots   = 1.94384</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> pi        = 3.14159</span></div><div style="margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;</span></div><div style="margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> latvals   = new((/801/),float,1e+30)</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> lonvals   = new((/810/),float,1e+30)</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> speed     = new((/801,810/),float,1e+30)  </span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> <font color="#ff2600">var01     = new((/251,73/),float,1e+30)</font></span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><font color="#ff2600"> var0      = new((/251/),float,1e+30)</font></span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> </span></div><div style="margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;<wbr>;</span></div><div style="margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> slpsub       = slp(time,0,:,:) ; X is now a 2D array</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> speed(:,:)   = wind_speed(u10(time,0,:,:),v10<wbr>(time,0,:,:)) * toknots</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> latvals(:)   = u10&lat(0:800)</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> lonvals(:)   = u10&lon(0:809)</span></div><div style="margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> coord        = center_find(speed(:,:),slpsub)<wbr> </span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> lat1         = coord[0]</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> lon1         = coord[1]</span></div><div style="margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">;;;;;;;;;;;;;; Find all variables here and store into allvars ;;;;;;;</span></div><span><div style="margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><font color="#ff2600"> wnout        = wn01(latvals,lonvals,lat1,lon1<wbr>,speed)   </font></span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><font color="#ff2600"> var0         = wnout[0] </font></span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"><font color="#ff2600"> var1         = wnout[1]  </font></span></div><div style="margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div></span><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures">;;;;;;;;;;;;;;;;;;;;;; Write to a netcdf file ;;;;;;;;;;;;;;;;;;</span></div><div style="margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> system("rm -f $f1_$<a href="http://f2.nc/" target="_blank">f2.nc</a>")</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> ncdf = addfile("$f1_$<a href="http://f2.nc/" target="_blank">f2.nc</a>","c")</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> ncdf->allvars = allvars</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> ncdf->yymmdd  = $f1</span></div><div style="margin:0px;line-height:normal"><span style="font-variant-ligatures:no-common-ligatures"> ncdf->time    = $f2</span></div><div style="margin:0px;line-height:normal;min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"> </span><br class="m_1702101270116292477m_5598048521643050020m_-8056821693561989853webkit-block-placeholder"></div><div><span style="font-variant-ligatures:no-common-ligatures">------------------------------<wbr>------------------------------<wbr>-------</span></div></span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"><font color="#ff2600"><br></font></span></div><div style="margin:0px;font-size:12px;line-height:normal;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"><b><u>FUNCTION </u></b></span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">load "$NCARG_ROOT/lib/ncarg/nclscri<wbr>pts/csm/contributed.ncl"</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">load "/scratch/lustreD/s/sbhalach/D<wbr>ATA/func_center.ncl"</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"><font color="#ff2600">undef</font>("wn01")</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> function wn01(latvals:float,lonvals:flo<wbr>at,lat1:float,lon1:float,var:f<wbr>loat)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> <font color="#ff2600">local</font> R,d2r,r2d,toknots,pi,delr,Xi,Y<wbr>i,xo,yo,nearxo,nearyo,ovar,var<wbr>01,var0,c1,b1,orad,otha,arr,a1<wbr>,a2,a3,a4,a5,a6,a7,a8,a9,r,wei<wbr>ghts </span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> begin </span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> R         = 6371 </span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> d2r       = atan(1.0)/45; Equivalent of pi/180 or 0.01745329</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> r2d       = 1.0/d2r</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> toknots   = 1.94384</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> pi        = 3.14159 </span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> delr      = 12</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> Xi        = new((/810/),float,1e+30)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> Yi        = new((/801/),float,1e+30)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> ovar      = new((/251,73/),float,1e+30)  </span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> var01     = new((/251,73/),float,1e+30)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> var0      = new((/251/),float,1e+30)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> c1        = new((/251/),float,1e+30)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> b1        = new((/251/),float,1e+30)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> orad      = ispan(0,1000,delr)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> otha      = fspan(0,6.283185,73)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> arr       = new((/3,3/),float,1e+30)  </span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> Xi(:) = R *cos(lat1*d2r)*(lonvals(:)-lon<wbr>1) * d2r</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> Yi(:) = R *(latvals(:)-lat1) * d2r</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"> </span><br class="m_1702101270116292477m_5598048521643050020m_-8056821693561989853webkit-block-placeholder"></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> do radius=0,250,1 </span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">  do theta=0,72,1   </span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">    xo  = (radius*delr)*cos((theta*5)*d2<wbr>r)   ; reference points </span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">    yo  = (radius*delr)*sin((theta*5)*d2<wbr>r)   ; reference points</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures">  </span><br class="m_1702101270116292477m_5598048521643050020m_-8056821693561989853webkit-block-placeholder"></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">    nearxo = ind_nearest_coord (xo, Xi(:), 0)  ;Find the index of the bounds</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">    nearyo = ind_nearest_coord (yo, Yi(:), 0) </span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">    if(nearxo .eq. 0 .or. nearxo .eq. 809 .or. nearyo .eq. 0 .or. nearyo .eq. 800) then</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">    ovar(radius,theta) = var(nearyo,nearxo)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">  else</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">   a1 = var(nearyo+1,nearxo+1)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">   a2 = var(nearyo+1,nearxo)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">   a3 = var(nearyo-1,nearxo-1)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">   a4 = var(nearyo,nearxo+1)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">   a5 = var(nearyo,nearxo)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">   a6 = var(nearyo,nearxo-1)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">   a7 = var(nearyo-1,nearxo+1)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">   a8 = var(nearyo-1,nearxo)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">   a9 = var(nearyo-1,nearxo-1)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">   arr = (/ (/a1,a2,a3/), (/a4,a5,a6/), (/a7,a8,a9/)/)   ; Written as nD arrays for visual clarity of neighbors</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">   weights = (/ (/0.0625,0.0625,0.0625/), (/0.0625,0.5,0.0625/), (/0.0625,0.0625,0.0625/)/) </span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">   ovar(radius,theta) =  dim_avg_wgt(ndtooned(arr),ndto<wbr>oned(weights),1)  </span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">;  Give 50% weight to the nearest location and distribute the other 50% equally amongst the neighbours  </span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">   end if</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">  end do ; Loop over every radius and theta </span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> end do    ; End of r-theta loop</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">  do r=0,250,1 </span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">     <font color="#ff2600">var0(r)</font>    =  1/(2*pi)*simpeq(ovar(r,:),5.0*<wbr>d2r)                    ; Dimension </span>(/251/)</div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">     c1(r)      =  1/(2*pi)*simpeq(ovar(r,:)*cos(<wbr>otha),5.0*d2r)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">     b1(r)      =  1/(2*pi)*simpeq(ovar(r,:)*sin(<wbr>otha),5.0*d2r)</span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">     <font color="#ff2600">var01(r,:)</font> =  var0(r) + (c1(r)*cos(otha)) + (b1(r)*sin(otha))<span class="m_1702101270116292477m_5598048521643050020m_-8056821693561989853Apple-tab-span" style="white-space:pre-wrap">        </span> ; Dimension </span>(/251,73/)</div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures">  end do    </span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> <font color="#ff2600">return([/var0,var01/])</font></span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255)"><span style="font-variant-ligatures:no-common-ligatures"> end </span></div><div><div class="m_1702101270116292477m_5598048521643050020h5"><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><span style="font-variant-ligatures:no-common-ligatures"></span><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><br></div><div style="margin:0px;font-size:12px;line-height:normal;font-family:Monaco;background-color:rgb(255,255,255);min-height:16px"><br></div><div><blockquote type="cite"><div>On Oct 14, 2017, at 12:42 AM, Marston Johnston <<a href="mailto:shejo284@gmail.com" target="_blank">shejo284@gmail.com</a>> wrote:</div><br class="m_1702101270116292477m_5598048521643050020m_-8056821693561989853Apple-interchange-newline"><div><div class="m_1702101270116292477m_5598048521643050020m_-8056821693561989853WordSection1" style="font-family:PalatinoLinotype-Roman;font-size:14px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255)"><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span>There is an error in your code:        var0 = new((/251/),float,1e+30<u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span>As a preference, I always find it best to use the default FillValues when creating arrays. Read up on missing values/fillvalues on the NCL wedpage.<u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span><u></u> <u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span>There is nothing wrong with returning a list from a function, even if the dimensions are different. Why would the dimensions matter?<u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span>This doesn’t seem to be your problem. You have not provided enough information about your code and variable information (printVarSumary) to give a definite answer.<u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span>It seems you need to do some more debugging of your code yourself.<u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span><u></u> <u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span>When defining functions, it is good practice to set the define the intrinsic variables as “local” as well as using the “undef” function.<span class="m_1702101270116292477m_5598048521643050020m_-8056821693561989853Apple-converted-space"> </span><u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span>Using the same name for the variables inside and outside the function, if you are indeed using a function that is properly designed, can mask a bug in your code.<span class="m_1702101270116292477m_5598048521643050020m_-8056821693561989853Apple-converted-space"> </span><u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span><u></u> <u></u></span></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:'Times New Roman',serif;color:rgb(0,112,192)">~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:'Times New Roman',serif;color:rgb(0,112,192)">Marston S. Ward, PhD<u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:'Times New Roman',serif;color:rgb(0,112,192)">Department of Earth Sciences<u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:'Times New Roman',serif;color:rgb(0,112,192)">University of Gothenburg, Sweden<u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:'Times New Roman',serif;color:rgb(0,112,192)">Email: <a href="mailto:marston.johnston@gu.se" style="color:rgb(149,79,114);text-decoration:underline" target="_blank"><span style="color:rgb(0,112,192)">marston.johnston@gu.se</span></a><u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:'Times New Roman',serif;color:rgb(0,112,192)">SkypeID: marston.johnston <u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:'Times New Roman',serif;color:rgb(0,112,192)">Phone: <a href="tel:+46%2031%20786%2049%2001" value="+46317864901" target="_blank">+46-31-7864901</a> <u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:'Times New Roman',serif;color:rgb(0,112,192)">Only the fruitful thing is true!<u></u><u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span style="font-size:12pt;font-family:'Times New Roman',serif;color:rgb(0,112,192)">~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<u></u><u></u></span></div></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span><u></u> <u></u></span></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><span><u></u> <u></u></span></div><div style="border-style:solid none none;border-top-width:1pt;border-top-color:rgb(181,196,223);padding:3pt 0cm 0cm"><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><b><span style="font-size:12pt">From:<span class="m_1702101270116292477m_5598048521643050020m_-8056821693561989853Apple-converted-space"> </span></span></b><span style="font-size:12pt">ncl-talk <<a href="mailto:ncl-talk-bounces@ucar.edu" target="_blank">ncl-talk-bounces@ucar.edu</a>> on behalf of Prashanth Bhalachandran <<a href="mailto:prashanth.bhalachandran@gmail.com" target="_blank">prashanth.bhalachandran@gmail<wbr>.com</a>><br><b>Date:<span class="m_1702101270116292477m_5598048521643050020m_-8056821693561989853Apple-converted-space"> </span></b>Saturday, 14 October 2017 at 03:57<br><b>To:<span class="m_1702101270116292477m_5598048521643050020m_-8056821693561989853Apple-converted-space"> </span></b><<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>><br><b>Subject:<span class="m_1702101270116292477m_5598048521643050020m_-8056821693561989853Apple-converted-space"> </span></b>Re: [ncl-talk] Function return<u></u><u></u></span></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">Hello, <u></u><u></u></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">I have a quick question regarding returning of arrays from functions. <u></u><u></u></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif"><u></u> <u></u></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">In my code, I have two arrays var0 and var01 that I want to return from my function. Their dimensionalities are as follows: <u></u><u></u></div></div><div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:rgb(237,234,212)"><span style="font-size:12pt;font-family:Courier,serif;color:rgb(184,45,24)"><br><br><u></u><u></u></span></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:rgb(237,234,212)"><span style="font-size:12pt;font-family:Courier,serif;color:rgb(184,45,24)">var0      = new((/251/),float,1e+30<u></u><u></u></span></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:rgb(237,234,212)"><span style="font-size:12pt;font-family:Courier,serif;color:rgb(184,45,24)">var01     = new((/251,73/),float,1e+30)<u></u><u></u></span></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:rgb(237,234,212)"><span style="font-size:12pt;font-family:Courier,serif;color:rgb(184,45,24)"> <span class="m_1702101270116292477m_5598048521643050020m_-8056821693561989853apple-tab-span">   <span class="m_1702101270116292477m_5598048521643050020m_-8056821693561989853Apple-converted-space"> </span></span><u></u><u></u></span></div></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:rgb(237,234,212)"><span style="font-size:12pt;font-family:Courier,serif;color:rgb(184,45,24)"><u></u> <u></u></span></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:rgb(237,234,212)"><span style="font-size:12pt;font-family:Courier,serif;color:rgb(184,45,24)">At present, I am trying to return this using the command : <u></u><u></u></span></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:rgb(237,234,212)"><span style="font-size:12pt;font-family:Courier,serif;color:rgb(184,45,24)"><u></u> <u></u></span></div></div><div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:rgb(237,234,212)"><span style="font-size:12pt;font-family:Courier,serif;color:rgb(77,47,45)">return([/var0,var01/]) ; Note that the dimensions of var0 and var1 are different. <u></u><u></u></span></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:rgb(237,234,212)"><span style="font-size:12pt;font-family:Courier,serif;color:rgb(77,47,45)"><br><br><u></u><u></u></span></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:rgb(237,234,212)"><span style="font-size:12pt;font-family:Courier,serif;color:rgb(77,47,45)">As a result, in my wrapper script, when I receive the variables, it is becoming a confusing task. <u></u><u></u></span></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:rgb(237,234,212)"><span style="font-size:12pt;font-family:Courier,serif;color:rgb(77,47,45)"><br><br><u></u><u></u></span></div></div><div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:rgb(237,234,212)"><span style="font-size:12pt;font-family:Courier,serif;color:rgb(184,45,24)"> wnout        = wn01(latvals,lonvals,lat1,lon1<wbr>,speed)   <u></u><u></u></span></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:rgb(237,234,212)"><span style="font-size:12pt;font-family:Courier,serif;color:rgb(184,45,24)"> var0         = wnout[0] <u></u><u></u></span></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:rgb(237,234,212)"><span style="font-size:12pt;font-family:Courier,serif;color:rgb(184,45,24)"> var1         = wnout[1]  <u></u><u></u></span></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:rgb(237,234,212)"><span style="font-size:12pt;font-family:Courier,serif;color:rgb(184,45,24)"><br><br><u></u><u></u></span></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:rgb(237,234,212)"><span style="font-size:12pt;font-family:Courier,serif;color:rgb(184,45,24)"> The above return procedure is giving out an error since I don’t know how to define the dimensions of wnout. Is there any better way to return two arrays of varying dimensions in NCL? <u></u><u></u></span></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:rgb(237,234,212)"><span style="font-size:12pt;font-family:Courier,serif;color:rgb(184,45,24)"><br><br><u></u><u></u></span></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:rgb(237,234,212)"><span style="font-size:12pt;font-family:Courier,serif;color:rgb(184,45,24)">Thank you, <u></u><u></u></span></div></div><div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif;background-color:rgb(237,234,212)"><span style="font-size:12pt;font-family:Courier,serif;color:rgb(184,45,24)">Prashanth  <u></u><u></u></span></div></div></div></div><div style="margin:0cm 0cm 0.0001pt;font-size:11pt;font-family:Calibri,sans-serif">______________________________<wbr>_________________ ncl-talk mailing list<span class="m_1702101270116292477m_5598048521643050020m_-8056821693561989853Apple-converted-space"> </span><a href="mailto:ncl-talk@ucar.edu" style="color:rgb(149,79,114);text-decoration:underline" target="_blank">ncl-talk@ucar.edu</a><span class="m_1702101270116292477m_5598048521643050020m_-8056821693561989853Apple-converted-space"> </span>List instructions, subscriber options, unsubscribe:<span class="m_1702101270116292477m_5598048521643050020m_-8056821693561989853Apple-converted-space"> </span><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" style="color:rgb(149,79,114);text-decoration:underline" target="_blank">http://mailman.uc<wbr>ar.edu/mailman/listinfo/ncl-ta<wbr>lk</a><u></u><u></u></div></div></div></blockquote></div><br></div></div></div></div><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" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div></div>
</div></blockquote></div><br></div></div></div></div></div></blockquote></div><br></div>