<div dir="ltr"><div>Hello,</div><div><br></div><div>I'm currently trying to make dynamic variable names within NCL (i.e., with unique prefix and/or suffix, but consistent patterns for each variable). I've tried to track down a solution for my current problem via the NCL archives, but can't seem to find it. A post in 2010 said that this type of NCL scripting wasn't yet possible, but I was curious if an update had occurred. </div><div><br></div><div><div>I'm trying to do the following...</div><div><br></div><div>Assess several different mountain ranges</div><div>With four different variables (SNOWFALL, SNOWC, SWE, TSA)</div><div>Across four different elevation classes (500 m, 1000 m, 1500 m, 2000 m)</div><div><br></div><div>This is my current stab at making the dynamic variable names within NCL, but of course, it isn't working (although the print statement is working, the NCL functions just don't like the syntax used to name the dynamic variable names). Here is a snippet of the code...</div></div><div><br></div><div>;------------------------------------------------------</div><div>; STAT DISPERSION</div><div>;------------------------------------------------------</div><div> opt = True</div><div> opt@PrintStat = True</div><div><br></div><div> vars = (/"SNOWFALL","SNOWC","SWE","TSA"/)</div><div> elev = (/"500","1000","1500","2000"/)</div><div> nvars = dimsizes(vars)-1</div><div> nelev = dimsizes(elev)-1</div><div><br></div><div> do n=0,nvars</div><div> do k=0,nelev</div><div> print("VR-CESM28 - HISTORICAL - AVG DJF Sierra Nevada "+elev(k)+" "+vars(n)+"")</div><div> Sierra_STAT_VR_CESM_28_HIST_+vars(n)+elev(k)+ = stat_dispersion(oned_+vars(n)+_VR_CESM_28_HIST_+elev(k)+,opt)</div><div><br></div><div> end do</div><div> end do</div><div><br></div><div>Do you have any advice on how to move forward on this? I have heard that it is possible to read in variable names via a shell script into NCL, but I can't track down an example of how to do this either.</div><div><br></div><div>Thanks in advance,</div><div><br></div><div>AR</div><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><font color="#006600"><div style="font-weight:bold"><br></div><div><font color="#006600" size="2"><b>Alan Rhoades</b></font></div></font><div><div><b><font color="#000000" size="1">PhD Student, Atmospheric Science Graduate Group</font></b></div><div><b><font color="#000000" size="1">Climate Change Water and Society (CCWAS) NSF IGERT Trainee</font></b></div><div><b><font color="#000000" size="1">University of California, Davis</font></b></div><div><span style="font-family:arial,sans-serif;background-color:rgb(255,255,255)"><u><b><a href="https://www.linkedin.com/pub/alan-rhoades/22/5bb/52a" target="_blank"><font color="#0000ff" size="1">LinkedIn</font></a></b></u></span></div><div><span style="font-family:arial,sans-serif;background-color:rgb(255,255,255)"><u><b><font size="1"><a href="mailto:alan.m.rhoades@gmail.com" target="_blank">alan.m.rhoades@gmail.com</a> </font></b></u></span></div><div><span style="font-family:arial,sans-serif;background-color:rgb(255,255,255)"><u><b><a href="mailto:amrhoades@ucdavis.edu" target="_blank"><font size="1">amrhoades@ucdavis.edu</font></a></b></u></span></div></div><div><font color="#003300" size="1"><b><br></b></font></div><div><b><i><font color="#006600" size="1">"It’s all really there. That’s what really gets you. But you gotta stop and think about it to really get the pleasure about the complexity, the inconceivable nature of nature."</font></i></b></div><div><b><i><font color="#006600" size="1">Richard Feynman</font></i></b></div></div></div></div></div></div></div>
</div>