[ncl-talk] Loop creating different variable names
Anne
anne.seidenglanz at unive.it
Tue Feb 27 04:18:22 MST 2018
Hello,
I am trying to loop through a number of months (like *month = (/"nov",
"dec", "jan"/)*) to compute some climatologies (I know there are functions
but I need to do it manually here). Because I am reading in and plotting 4
different data sets I am looking for way to loop over the months, *in order
to become part of the new variable name*, so as to make the script shorter
and better readable.
My "$" syntax doesn't seem to work here (see below). There was an ncl talk
a few years ago saying that one needs to treat the months as attributes of
another variable in order to be able to use the "$" syntax, is that still
the case?
month = (/"nov", "dec", "jan"/)
do m=0,dimsizes(month)-1
var_$month(m)$_nsidc = var_dtrend_nsidc(0::12,:,:)
end do
*I want to end up with:*
var_nov_nsidc
var_dec_nsidc
var_jan_nsidc
What am I doing wrong here?
Any help appreciated,
thanks
Anne
--
Nota automatica aggiunta dal sistema di posta.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180227/467b1bbf/attachment.html>
More information about the ncl-talk
mailing list