<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Rashed:</div><div class="gmail_default" style="font-size:small">What your proposed only works if I were to loop over cells. This would take quite some time if cells were a large number? There must be some kind of an array syntax to do this.</div><div class="gmail_default" style="font-size:small">Thanks,</div><div class="gmail_default" style="font-size:small">Laura</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 5, 2020 at 12:08 PM Rashed Mahmood <<a href="mailto:rashidcomsis@gmail.com">rashidcomsis@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Hi Laura,</div><div>The error message is telling what is wrong, you defining a one dimensional and then trying to assign it two dimensional data:<br></div><div>
<div class="gmail_default"><b>ppbl = new((/cells/),typeof(p))</b></div><div class="gmail_default"><b>ppbl(0:cells-1) = p(0:cells-1,kpbl(0:cells-1)) ; <span style="color:rgb(255,0,0)">this is 2D and even wrong dimension sizes note the nVertLevels</span><br></b></div><div class="gmail_default">
<div class="gmail_default"><br></div><div class="gmail_default"><br></div><div class="gmail_default">I am not sure if the following is what you want?<br></div><div class="gmail_default"><br></div><div class="gmail_default">vlevel = 0 ; 0 or any other VertLevels<br></div><div class="gmail_default">ppbl = new((/cells/),typeof(p))</div><div class="gmail_default">ppbl(0:cells-1) = p(0:cells-1,vlevel)</div><div class="gmail_default"><br></div>

</div><div class="gmail_default"><br></div><div class="gmail_default">Cheers,</div><div class="gmail_default">Rashed<br></div><div class="gmail_default"><br></div>

</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 5, 2020 at 8:37 AM Laura Fowler via ncl-talk <<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-size:small"><div class="gmail_default">Hello:</div><div class="gmail_default">I cannot figure out how to do the following and would love to get some help:<br></div><div class="gmail_default"><br></div><div class="gmail_default">I have an array kpbl which contains the vertical index of the PBL top: printVarSummary gives:</div><div class="gmail_default"><br></div><div class="gmail_default"><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Variable: kpbl</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Type: integer</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Total Size: 15728832 bytes</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">            3932208 values</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Number of Dimensions: 2</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Dimensions and sizes:<span style="white-space:pre-wrap">  </span>[Time | 13] x [cells | 163842]</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Coordinates: </span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Number Of Attributes: 2</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">  units :<span style="white-space:pre-wrap">      </span>unitless</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">  long_name :<span style="white-space:pre-wrap">     </span>index level of PBL top</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><br></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-size:small;font-family:Arial,Helvetica,sans-serif;color:rgb(34,34,34)">I have a second array p which contains the 3D pressure: print VarSummary gives:</span><br></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-size:small;font-family:Arial,Helvetica,sans-serif;color:rgb(34,34,34)"><br></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Variable: p</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Type: float</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Total Size: 865085760 bytes</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">            216271440 values</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Number of Dimensions: 3</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Dimensions and sizes:<span style="white-space:pre-wrap">   </span>[Time | 13] x [cells | 163842] x [nVertLevels | 55]</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Coordinates: </span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Number Of Attributes: 2</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">  units :<span style="white-space:pre-wrap"> </span>hPa</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">  long_name :<span style="white-space:pre-wrap">    </span>Pressure</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:13px;line-height:normal;font-family:Courier;color:rgb(0,0,0)"><span style="font-size:small;font-family:Arial,Helvetica,sans-serif;color:rgb(34,34,34)"><br></span></p></div><div class="gmail_default"><br></div><div class="gmail_default">What I would like to get is the pressure at the index level kpbl, i.e. pressure at the PBL top. In fortran and for one time-level (itime), I would have a loop like:</div><div class="gmail_default"><br></div><div class="gmail_default">do icell = 0, cells-1<br></div><div class="gmail_default">     ppbl(itime,icell) = p(itime,icell,kpbl(iCell))</div><div class="gmail_default">end do</div><div class="gmail_default"><br></div><div class="gmail_default">In NCL, I tried the following (for one time-level):</div><div class="gmail_default">ppbl = new((/cells/),typeof(p))</div><div class="gmail_default">ppbl(0:cells-1) = p(0:cells-1,kpbl(0:cells-1))</div><div class="gmail_default"><br></div><div class="gmail_default">but this does not work. I get an error message that the left and right side do not have the same dimensions. I am definitely running out of ideas on how to solve this and would appreciate a hint.</div><div class="gmail_default"><br></div><div class="gmail_default">Many thanks,</div><div class="gmail_default">Laura</div><font color="#888888"><div class="gmail_default"><br></div></font></div>-- <br><div dir="ltr"><div dir="ltr"><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">!-------------------------------------------------------------------------------------------------------------</font><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">Laura D. Fowler                                                                                       </font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">Mesoscale and Microscale Meteorology Division (MMM)         </font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">National Center for Atmospheric Research<br></font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">P.O. Box 3000, Boulder CO 80307-3000</font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff"><br></font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">e-mail: <a href="mailto:laura@ucar.edu" target="_blank">laura@ucar.edu</a></font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">phone: 303-497-1628</font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff"><br></font></div><div><font style="background-color:rgb(255,255,255)" face="arial, helvetica, sans-serif" color="#0000ff">!-------------------------------------------------------------------------------------------------------------</font><br></div></div></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>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><font face="arial, helvetica, sans-serif" color="#0000ff" style="background-color:rgb(255,255,255)">!-------------------------------------------------------------------------------------------------------------</font><div><font face="arial, helvetica, sans-serif" color="#0000ff" style="background-color:rgb(255,255,255)">Laura D. Fowler                                                                                       </font></div><div><font face="arial, helvetica, sans-serif" color="#0000ff" style="background-color:rgb(255,255,255)">Mesoscale and Microscale Meteorology Division (MMM)         </font></div><div><font face="arial, helvetica, sans-serif" color="#0000ff" style="background-color:rgb(255,255,255)">National Center for Atmospheric Research<br></font></div><div><font face="arial, helvetica, sans-serif" color="#0000ff" style="background-color:rgb(255,255,255)">P.O. Box 3000, Boulder CO 80307-3000</font></div><div><font face="arial, helvetica, sans-serif" color="#0000ff" style="background-color:rgb(255,255,255)"><br></font></div><div><font face="arial, helvetica, sans-serif" color="#0000ff" style="background-color:rgb(255,255,255)">e-mail: <a href="mailto:laura@ucar.edu" target="_blank">laura@ucar.edu</a></font></div><div><font face="arial, helvetica, sans-serif" color="#0000ff" style="background-color:rgb(255,255,255)">phone: 303-497-1628</font></div><div><font face="arial, helvetica, sans-serif" color="#0000ff" style="background-color:rgb(255,255,255)"><br></font></div><div><font face="arial, helvetica, sans-serif" color="#0000ff" style="background-color:rgb(255,255,255)">!-------------------------------------------------------------------------------------------------------------</font><br></div></div></div>