Re: convert date string

From: Bormann, Kathryn J (3246-Affiliate) <Kathryn.J.Bormann_at_nyahnyahspammersnyahnyah>
Date: Mon Jan 27 2014 - 12:30:17 MST

Hi Chang,

To convert dates from "24 Jun 1990" format to yyyymmdd I would just
manipulate the strings to the correct format manually, and do something
like this:

;specify matching month/month of year arrays
mmm = (/"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep",
"Oct", "Nov", "Dec" /)
mn = (/"01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11",
"12"/)

;a dummy example of your input data (line by line)
x = (/"24 Jun 1990", "25 Aug 1991"/)

;assuming the input dates are of consistent format
;split the input date using columns
dd = str_get_cols(x, 0, 1)
yyyy = str_get_cols(x, 7, 10)
MMM = str_get_cols(x, 3, 5) ;extracts (/"Jun", "Aug"/) in this example

;convert mmm to mm (can do this easily one at a time)
;although this may not be the most efficient method**
mm = new( dimsizes(x), "string")
do i=0,dimsizes(x)-1
  mm(i) = mn(ind(MMM(i) .eq. mmm))
end do

;stitch the components together in desired format
yyyymmdd = yyyy+mm+dd
print(yyyymmdd)

Variable: yyyymmdd
Type: string
Total Size: 16 bytes
            2 values
Number of Dimensions: 1
Dimensions and sizes: [2]
Coordinates:
Number Of Attributes: 1
  _FillValue : missing
(0) 19900624
(1) 19910825

Hope this helps

--
Kat Bormann
NASA Postdoctoral Fellow
Jet Propulsion Laboratory
California Institute of Technology
Pasadena, CA 91109
On 1/27/14 11:00 AM, "ncl-talk-request@ucar.edu"
<ncl-talk-request@ucar.edu> wrote:
>Send ncl-talk mailing list submissions to
>	ncl-talk@ucar.edu
>
>To subscribe or unsubscribe via the World Wide Web, visit
>	http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>or, via email, send a message with subject or body 'help' to
>	ncl-talk-request@ucar.edu
>
>You can reach the person managing the list at
>	ncl-talk-owner@ucar.edu
>
>When replying, please edit your Subject line so it is more specific
>than "Re: Contents of ncl-talk digest..."
>
>
>Today's Topics:
>
>   1. Writing netcdf files (Almami Johnson)
>   2. convert date string, (Xi Chang)
>   3. Re: Writing netcdf files (brownrig@ucar.edu)
>   4. backward difference (Verena Lili)
>   5. Re: backward difference (Dennis Shea)
>   6. Re: Writing netcdf files (Dennis Shea)
>   7. Re: Writing netcdf files (Almami Johnson)
>   8. simple daily anomalies (Xi Chang)
>   9. Re: simple daily anomalies (Xi Chang)
>  10. Re: simple daily anomalies (Alan Brammer)
>  11. lat and lon grids (Kumar, Anil (GSFC-617.0)[UNIV OF MARYLAND])
>  12. looping over a series of separate files (Ioana Colfescu)
>  13. looping over a series of separate files (Ioana Colfescu)
>  14. Re: looping over a series of separate files (Kyle Griffin)
>
>
>----------------------------------------------------------------------
>
>Message: 1
>Date: Mon, 27 Jan 2014 10:58:40 +0000
>From: Almami Johnson <almamij@gmail.com>
>Subject: Writing netcdf files
>To: "ncl-talk@ucar.edu" <ncl-talk@ucar.edu>
>Message-ID:
>	<CAGDBja3YE3j7D5QqCOcthA0omyDKCXKWxv-cAKQRsiE20hJCvA@mail.gmail.com>
>Content-Type: text/plain; charset=ISO-8859-1
>
>Dear  NCL users
>
>I'm trying to calculate monthly potential evapotranspiration based on
>Thornthwaite (1948). I have each monthly term in a file named
>something.year.month.nc. I have created this script to output each
>month for a given year in a file named output.year.month.nc.
>The problem is all the output.year.month.nc are similar which makes me
>think NCL is writing the same thing in all the output files. Could you
>please take a look at this script and tell me what is wrong with it?
>Another problem I'm facing is that the ncdump -h of the outputs looks
>like this:
>
>dimensions:
>	time = UNLIMITED ; // (0 currently)
>	ncl1 = 20 ;
>	ncl2 = 12 ;
>	latitude = 180 ;
>	longitude = 280 ;
>variables:
>	float pet(ncl1, ncl2, latitude, longitude) ;
>		pet:units = "mm/month" ;
>		pet:long_name = "Potential Evap" ;
>		pet:_FillValue = 9.96921e+36f ;
>
>My question is how to output without ncl1 and ncl2 dimensions and have
>the time like time = UNLIMITED ; // (1 currently)
>
>Thanks for your help
>Almami
>
>--------------------------------------------------------------------------
>-----------------------------------------
>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
>begin
>
>;*************************************************************************
>****************
>; Creating Function to Read at once Precip and Convert Calendar to
>Human Readable YYYYMM
>;*************************************************************************
>****************
>   undef("getPrecip")
>   function getPrecip(fname[1]:string, vname[1]:string)
>   local x
>
>   begin
>     f       = addfile(fname, "r")
>     x       = f->$vname$(0,0,{-10:35},{-30:40})  ; read specified time
>period
>   return(x)
>   end
>
>   undef("getPrecip1")
>   function getPrecip1(fname[1]:string, vname[1]:string)
>   local y
>
>   begin
>     f       = addfile(fname, "r")
>     y       = f->$vname$(0,{-10:35},{-30:40})  ; read specified time
>period
>   return(y)
>   end
>
>;*************************************************************************
>****************
>; Creating a new variable corresponding to all the 12 months and getting
>each
>;*************************************************************************
>****************
>
>
>   reffile  = addfile("ENSMEAN_Pre_paren_2004_05.nc", "r")
>   refparam = reffile->t2m(:,0,{-10:35},{-30:40})
>   printVarSummary(refparam)
>
>   dim = dimsizes(refparam)
>   ntime= dim(0)
>   nlat = dim(1)
>   nlon = dim(2)
>
>   
>year=(/"1985","1986","1987","1988","1989","1990","1991","1992","1993","199
>4","1995","1996","1997","1998","1999","2000","2001","2002","2003","2004"/)
>   month=(/"01","02","03","04","05","06","07","08","09","10","11","12"/)
>   ndays=(/31,28,31,30,31,30,31,31,30,31,30,31/)
>
>   nyear= dimsizes(year)
>   nmon = dimsizes(month)
>
>    paren    = new((/nyear,nmon,nlat,nlon/), "float")
>    sunshine = new((/nyear,nmon,nlat,nlon/), "float")
>    alpha    = new((/nyear,nlat,nlon/), "float")
>    pot      = new((/nyear,nmon,nlat,nlon/), "float")
>
>
>  do i = 0, nyear - 1
>   do j = 0, nmon - 1
>
>   print("Getting data and preparing for " +year(i)+ " " +month(j)+ "
>and for paren alpha and sunshine duration")
>
>   paren(i,j,:,:) =
>getPrecip("ENSMEAN_Pre_paren_"+year(i)+"_"+month(j)+".nc","t2m")
>printVarSummary(paren(i,j,:,:))
>
>   sunshine(i,j,:,:) =
>getPrecip1("ENSMEAN_Pre_sund_"+year(i)+"_"+month(j)+".nc","sund")
>   printVarSummary(sunshine(i,j,:,:))
>
>   alpha(i,:,:) = getPrecip("ENSMEAN_Pre_alpha_"+year(i)+".nc","t2m")
>   printVarSummary(alpha(i,:,:))
>
>   print("Now taking potential evapotranspiration for " +year(i)+"
>"+month(j)+ " and for paren alpha and sunshine duration")
>
>   pot(i,j,:,:) =
>16*((paren(i,j,:,:))^(alpha(i,:,:)))*((sunshine(i,j,:,:))/12)*((ndays(j))/
>30)
>   copy_VarCoords(paren(i,j,:,:),pot(i,j,:,:))
>   printVarSummary(pot(i,j,:,:))
>
>;*************************************************************************
>******
>; Creating NetCDF files for writing and put time UNLIMITED
>;*************************************************************************
>******
>    print("Creating file
>ENSMEAN_Pre_pot_evap_"+year(i)+"_"+month(j)+".nc")
>
>      system("/bin/rm -f
>ENSMEAN_Pre_pot_evap_"+year(i)+"_"+month(j)+".nc")   ; remove any
>pre-existing file
>      pot_evap =
>addfile("ENSMEAN_Pre_pot_evap_"+year(i)+"_"+month(j)+".nc","c")  ;
>open output netCDF file
>
>
>; make time and UNLIMITED dimension      ; recommended  for most
>applications
>    filedimdef(pot_evap,"time",-1,True)
>
>;*************************************************************************
>***********************************
>; Writing down in the NetCDF files
>;*************************************************************************
>***********************************
>
>; output variables directly
>    print("Writing down pet in
>ENSMEAN_Pre_pot_evap_"+year(i)+"_"+month(j)+".nc")
>
>       pot!2    = "latitude"                      ; assign named
>dimensions
>       pot!3    = "longitude"
>
>       pot&latitude  = refparam&latitude
>       pot&longitude = refparam&longitude
>
>       pot@long_name = "Potential Evap"           ; assign attributes
>       pot@units     = "mm/month"
>       pot_evap->pet   = pot
>
>   end do
>  end do
>
>end
>--------------------------------------------------------------------------
>--------------------------------------
>
>
>------------------------------
>
>Message: 2
>Date: Mon, 27 Jan 2014 12:13:03 +0100
>From: Xi Chang <xi.chang01@gmail.com>
>Subject: convert date string,
>To: "ncl-talk@ucar.edu" <ncl-talk@ucar.edu>
>Message-ID:
>	<CAGfRhtfOV_QHCSS6dL=DwCNcT7fCy-FjUi3qTM11zz8++MiQXw@mail.gmail.com>
>Content-Type: text/plain; charset="iso-8859-1"
>
>I have the output of my codes in *txt something like this:
>
>17 Jan 1960
>28 Jan 1963
>16 Dec 1965
>23 Feb 1966
> 7 Jan 1968
>28 Nov 1968
>13 Mar 1969
>
>anybody know, what's the appropiate ncl function to convert these date
>to the form YYYYMMDD, thus the output will be:
>
>19600117
>19630128
>...
>
>
>thanks a lot.
>Chang
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: 
>http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140127/81e112d1/a
>ttachment.html 
>
>------------------------------
>
>Message: 3
>Date: Mon, 27 Jan 2014 06:44:32 -0700
>From: <brownrig@ucar.edu>
>Subject: Re: Writing netcdf files
>To: "Almami Johnson" <almamij@gmail.com>, "ncl-talk@ucar.edu"
>	<ncl-talk@ucar.edu>
>Message-ID: <web-50376564@mail.ucar.edu>
>Content-Type: text/plain;charset=utf-8; format="flowed"
>
>Hi,
>
>I suspect you may need to explicitly close each NetCDF file after
>writing to it with a "delete(pot_evap)" at the end of your
>doubly-nested loop.
>
>As for the dimensions, I'm not clear on your intent, but from the
>loop, were you wanting something more like:
>   
>    pot_evap->pet = pot(i,j,:,:)     ;; rather than "pot_eval->pet =
>pot"
>
>Hope that helps...
>Rick
>
>
>
>On Mon, 27 Jan 2014 10:58:40 +0000
>  Almami Johnson <almamij@gmail.com> wrote:
>> Dear  NCL users
>> 
>> I'm trying to calculate monthly potential evapotranspiration based
>>on
>> Thornthwaite (1948). I have each monthly term in a file named
>> something.year.month.nc. I have created this script to output each
>> month for a given year in a file named output.year.month.nc.
>> The problem is all the output.year.month.nc are similar which makes
>>me
>> think NCL is writing the same thing in all the output files. Could
>>you
>> please take a look at this script and tell me what is wrong with it?
>> Another problem I'm facing is that the ncdump -h of the outputs
>>looks like this:
>> 
>> dimensions:
>> 	time = UNLIMITED ; // (0 currently)
>> 	ncl1 = 20 ;
>> 	ncl2 = 12 ;
>> 	latitude = 180 ;
>> 	longitude = 280 ;
>> variables:
>> 	float pet(ncl1, ncl2, latitude, longitude) ;
>> 		pet:units = "mm/month" ;
>> 		pet:long_name = "Potential Evap" ;
>> 		pet:_FillValue = 9.96921e+36f ;
>> 
>> My question is how to output without ncl1 and ncl2 dimensions and
>>have
>> the time like time = UNLIMITED ; // (1 currently)
>> 
>> Thanks for your help
>> Almami
>> 
>> 
>>-------------------------------------------------------------------------
>>------------------------------------------
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>> 
>> begin
>> 
>> 
>>;************************************************************************
>>*****************
>> ; Creating Function to Read at once Precip and Convert Calendar to
>> Human Readable YYYYMM
>> 
>>;************************************************************************
>>*****************
>>   undef("getPrecip")
>>   function getPrecip(fname[1]:string, vname[1]:string)
>>   local x
>> 
>>   begin
>>     f       = addfile(fname, "r")
>>     x       = f->$vname$(0,0,{-10:35},{-30:40})  ; read specified
>>time period
>>   return(x)
>>   end
>> 
>>   undef("getPrecip1")
>>   function getPrecip1(fname[1]:string, vname[1]:string)
>>   local y
>> 
>>   begin
>>     f       = addfile(fname, "r")
>>     y       = f->$vname$(0,{-10:35},{-30:40})  ; read specified time
>>period
>>   return(y)
>>   end
>> 
>> 
>>;************************************************************************
>>*****************
>> ; Creating a new variable corresponding to all the 12 months and
>>getting each
>> 
>>;************************************************************************
>>*****************
>> 
>> 
>>   reffile  = addfile("ENSMEAN_Pre_paren_2004_05.nc", "r")
>>   refparam = reffile->t2m(:,0,{-10:35},{-30:40})
>>   printVarSummary(refparam)
>> 
>>   dim = dimsizes(refparam)
>>   ntime= dim(0)
>>   nlat = dim(1)
>>   nlon = dim(2)
>> 
>>   
>>year=(/"1985","1986","1987","1988","1989","1990","1991","1992","1993","19
>>94","1995","1996","1997","1998","1999","2000","2001","2002","2003","2004"
>>/)
>>   month=(/"01","02","03","04","05","06","07","08","09","10","11","12"/)
>>   ndays=(/31,28,31,30,31,30,31,31,30,31,30,31/)
>> 
>>   nyear= dimsizes(year)
>>   nmon = dimsizes(month)
>> 
>>    paren    = new((/nyear,nmon,nlat,nlon/), "float")
>>    sunshine = new((/nyear,nmon,nlat,nlon/), "float")
>>    alpha    = new((/nyear,nlat,nlon/), "float")
>>    pot      = new((/nyear,nmon,nlat,nlon/), "float")
>> 
>> 
>>  do i = 0, nyear - 1
>>   do j = 0, nmon - 1
>> 
>>   print("Getting data and preparing for " +year(i)+ " " +month(j)+ "
>> and for paren alpha and sunshine duration")
>> 
>>   paren(i,j,:,:) =
>> getPrecip("ENSMEAN_Pre_paren_"+year(i)+"_"+month(j)+".nc","t2m")
>> printVarSummary(paren(i,j,:,:))
>> 
>>   sunshine(i,j,:,:) =
>> getPrecip1("ENSMEAN_Pre_sund_"+year(i)+"_"+month(j)+".nc","sund")
>>   printVarSummary(sunshine(i,j,:,:))
>> 
>>   alpha(i,:,:) = getPrecip("ENSMEAN_Pre_alpha_"+year(i)+".nc","t2m")
>>   printVarSummary(alpha(i,:,:))
>> 
>>   print("Now taking potential evapotranspiration for " +year(i)+"
>> "+month(j)+ " and for paren alpha and sunshine duration")
>> 
>>   pot(i,j,:,:) =
>> 
>>16*((paren(i,j,:,:))^(alpha(i,:,:)))*((sunshine(i,j,:,:))/12)*((ndays(j))
>>/30)
>>   copy_VarCoords(paren(i,j,:,:),pot(i,j,:,:))
>>   printVarSummary(pot(i,j,:,:))
>> 
>> 
>>;************************************************************************
>>*******
>> ; Creating NetCDF files for writing and put time UNLIMITED
>> 
>>;************************************************************************
>>*******
>>    print("Creating file
>>ENSMEAN_Pre_pot_evap_"+year(i)+"_"+month(j)+".nc")
>> 
>>      system("/bin/rm -f
>> ENSMEAN_Pre_pot_evap_"+year(i)+"_"+month(j)+".nc")   ; remove any
>> pre-existing file
>>      pot_evap =
>> addfile("ENSMEAN_Pre_pot_evap_"+year(i)+"_"+month(j)+".nc","c")  ;
>> open output netCDF file
>> 
>> 
>> ; make time and UNLIMITED dimension      ; recommended  for most
>>applications
>>    filedimdef(pot_evap,"time",-1,True)
>> 
>> 
>>;************************************************************************
>>************************************
>> ; Writing down in the NetCDF files
>> 
>>;************************************************************************
>>************************************
>> 
>> ; output variables directly
>>    print("Writing down pet in
>> ENSMEAN_Pre_pot_evap_"+year(i)+"_"+month(j)+".nc")
>> 
>>       pot!2    = "latitude"                      ; assign named
>>dimensions
>>       pot!3    = "longitude"
>> 
>>       pot&latitude  = refparam&latitude
>>       pot&longitude = refparam&longitude
>> 
>>       pot@long_name = "Potential Evap"           ; assign attributes
>>       pot@units     = "mm/month"
>>       pot_evap->pet   = pot
>> 
>>   end do
>>  end do
>> 
>> end
>> 
>>-------------------------------------------------------------------------
>>---------------------------------------
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
>------------------------------
>
>Message: 4
>Date: Mon, 27 Jan 2014 14:52:19 +0100
>From: Verena Lili <verena.prick@gmail.com>
>Subject: backward difference
>To: "ncl-talk@ucar.edu" <ncl-talk@ucar.edu>
>Message-ID:
>	<CAOFVKSDVqeEmvPyCGz2GLAOwMSf6TUkhD=dh7A9=EfrTOgSc5Q@mail.gmail.com>
>Content-Type: text/plain; charset="iso-8859-1"
>
>Dear NCL users,
>
>I'd like to perform a simple backward difference for zonal wind data in
>order to produce acceleration term: dU/dt= U(t)-U(t-1).
>
>Any helps would be really appreciated.
>Thanks
>
>-- 
>Regards,
>Dr. Verena.
>School of Marine and Atmospheric Sciences
>Stony Brook University
>homepage: http://www.somas.stonybrook.edu/
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: 
>http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140127/3dd6c676/a
>ttachment.html 
>
>------------------------------
>
>Message: 5
>Date: Mon, 27 Jan 2014 06:59:05 -0700
>From: Dennis Shea <shea@ucar.edu>
>Subject: Re: backward difference
>To: ncl-talk@ucar.edu
>Message-ID: <52E66629.9000205@ucar.edu>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>If U(time) the :
>
>    dimU = dimsizes(U)
>    ntim = dimU(0)
>
>    dudt = U(1:ntim-1) - U(0:ntim-2)
>
>====
>    U(time,lev,lat)
>
>    dudt = U(1:ntim-1,:,:) - U(0:ntim-2,:,:)
>
>====
>    printVarSummary(dudt)
>
>Cheers
>
>On 1/27/14, 6:52 AM, Verena Lili wrote:
>> Dear NCL users,
>>
>> I'd like to perform a simple backward difference for zonal wind data in
>> order to produce acceleration term: dU/dt= U(t)-U(t-1).
>>
>> Any helps would be really appreciated.
>> Thanks
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
>
>------------------------------
>
>Message: 6
>Date: Mon, 27 Jan 2014 07:29:25 -0700
>From: Dennis Shea <shea@ucar.edu>
>Subject: Re: Writing netcdf files
>To: Almami Johnson <almamij@gmail.com>
>Cc: "ncl-talk@ucar.edu" <ncl-talk@ucar.edu>
>Message-ID: <52E66D45.5060603@ucar.edu>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>A few comments on your script:
>
>The following
> 
>year=(/"1985","1986","1987","1988","1989","1990","1991","1992","1993","199
>4","1995","1996","1997","1998","1999","2000","2001","2002","2003","2004"/)
>month=(/"01","02","03","04","05","06","07","08","09","10","11","12"/)
>
>could be replaced with
>
>    years  = tostring(ispan(1985,2004,1))    ; string
>    months = sprinti("%0.2i", ispan(1,12,1))
>    print(months)
>
>But, given the context of your use, I would suggest
>    year   = ispan(1985,2004,1)              ; integer
>    month  = ispan(1,12,1)                   ; integer
>    months = sprinti("%0.2i", ispan(1,12,1)) ; string
>or
>
>
>=====
>Remove this ... you do not have a dimension named 'time'
>
> > ; make time and UNLIMITED dimension      ; recommended  for most
>applications
> >      filedimdef(pot_evap,"time",-1,True)
>
>=====
>As mentioned by RickB, your question is not very clear.
>
>You create arrays
>
> >      paren    = new((/nyear,nmon,nlat,nlon/), "float")
> >      sunshine = new((/nyear,nmon,nlat,nlon/), "float")
> >      alpha    = new((/nyear,nlat,nlon/), "float")
> >      pot      = new((/nyear,nmon,nlat,nlon/), "float")
>
>Then you do a double 'do loop' and write each time step. Why
>
>I'd suggest you write one file at the end.
>
>=====
>
>
>On 1/27/14, 6:44 AM, brownrig@ucar.edu wrote:
>> Hi,
>>
>> I suspect you may need to explicitly close each NetCDF file after
>> writing to it with a "delete(pot_evap)" at the end of your
>> doubly-nested loop.
>>
>> As for the dimensions, I'm not clear on your intent, but from the
>> loop, were you wanting something more like:
>>
>>      pot_evap->pet = pot(i,j,:,:)     ;; rather than "pot_eval->pet =
>> pot"
>>
>> Hope that helps...
>> Rick
>>
>>
>>
>> On Mon, 27 Jan 2014 10:58:40 +0000
>>    Almami Johnson <almamij@gmail.com> wrote:
>>> Dear  NCL users
>>>
>>> I'm trying to calculate monthly potential evapotranspiration based
>>> on
>>> Thornthwaite (1948). I have each monthly term in a file named
>>> something.year.month.nc. I have created this script to output each
>>> month for a given year in a file named output.year.month.nc.
>>> The problem is all the output.year.month.nc are similar which makes
>>> me
>>> think NCL is writing the same thing in all the output files. Could
>>> you
>>> please take a look at this script and tell me what is wrong with it?
>>> Another problem I'm facing is that the ncdump -h of the outputs
>>> looks like this:
>>>
>>> dimensions:
>>> 	time = UNLIMITED ; // (0 currently)
>>> 	ncl1 = 20 ;
>>> 	ncl2 = 12 ;
>>> 	latitude = 180 ;
>>> 	longitude = 280 ;
>>> variables:
>>> 	float pet(ncl1, ncl2, latitude, longitude) ;
>>> 		pet:units = "mm/month" ;
>>> 		pet:long_name = "Potential Evap" ;
>>> 		pet:_FillValue = 9.96921e+36f ;
>>>
>>> My question is how to output without ncl1 and ncl2 dimensions and
>>> have
>>> the time like time = UNLIMITED ; // (1 currently)
>>>
>>> Thanks for your help
>>> Almami
>>>
>>> 
>>>------------------------------------------------------------------------
>>>-------------------------------------------
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>>
>>> begin
>>>
>>> 
>>>;***********************************************************************
>>>******************
>>> ; Creating Function to Read at once Precip and Convert Calendar to
>>> Human Readable YYYYMM
>>> 
>>>;***********************************************************************
>>>******************
>>>    undef("getPrecip")
>>>    function getPrecip(fname[1]:string, vname[1]:string)
>>>    local x
>>>
>>>    begin
>>>      f       = addfile(fname, "r")
>>>      x       = f->$vname$(0,0,{-10:35},{-30:40})  ; read specified
>>> time period
>>>    return(x)
>>>    end
>>>
>>>    undef("getPrecip1")
>>>    function getPrecip1(fname[1]:string, vname[1]:string)
>>>    local y
>>>
>>>    begin
>>>      f       = addfile(fname, "r")
>>>      y       = f->$vname$(0,{-10:35},{-30:40})  ; read specified time
>>> period
>>>    return(y)
>>>    end
>>>
>>> 
>>>;***********************************************************************
>>>******************
>>> ; Creating a new variable corresponding to all the 12 months and
>>> getting each
>>> 
>>>;***********************************************************************
>>>******************
>>>
>>>
>>>    reffile  = addfile("ENSMEAN_Pre_paren_2004_05.nc", "r")
>>>    refparam = reffile->t2m(:,0,{-10:35},{-30:40})
>>>    printVarSummary(refparam)
>>>
>>>    dim = dimsizes(refparam)
>>>    ntime= dim(0)
>>>    nlat = dim(1)
>>>    nlon = dim(2)
>>>
>>>    
>>>year=(/"1985","1986","1987","1988","1989","1990","1991","1992","1993","1
>>>994","1995","1996","1997","1998","1999","2000","2001","2002","2003","200
>>>4"/)
>>>    
>>>month=(/"01","02","03","04","05","06","07","08","09","10","11","12"/)
>>>    ndays=(/31,28,31,30,31,30,31,31,30,31,30,31/)
>>>
>>>    nyear= dimsizes(year)
>>>    nmon = dimsizes(month)
>>>
>>>     paren    = new((/nyear,nmon,nlat,nlon/), "float")
>>>     sunshine = new((/nyear,nmon,nlat,nlon/), "float")
>>>     alpha    = new((/nyear,nlat,nlon/), "float")
>>>     pot      = new((/nyear,nmon,nlat,nlon/), "float")
>>>
>>>
>>>   do i = 0, nyear - 1
>>>    do j = 0, nmon - 1
>>>
>>>    print("Getting data and preparing for " +year(i)+ " " +month(j)+ "
>>> and for paren alpha and sunshine duration")
>>>
>>>    paren(i,j,:,:) =
>>> getPrecip("ENSMEAN_Pre_paren_"+year(i)+"_"+month(j)+".nc","t2m")
>>> printVarSummary(paren(i,j,:,:))
>>>
>>>    sunshine(i,j,:,:) =
>>> getPrecip1("ENSMEAN_Pre_sund_"+year(i)+"_"+month(j)+".nc","sund")
>>>    printVarSummary(sunshine(i,j,:,:))
>>>
>>>    alpha(i,:,:) = getPrecip("ENSMEAN_Pre_alpha_"+year(i)+".nc","t2m")
>>>    printVarSummary(alpha(i,:,:))
>>>
>>>    print("Now taking potential evapotranspiration for " +year(i)+"
>>> "+month(j)+ " and for paren alpha and sunshine duration")
>>>
>>>    pot(i,j,:,:) =
>>> 
>>>16*((paren(i,j,:,:))^(alpha(i,:,:)))*((sunshine(i,j,:,:))/12)*((ndays(j)
>>>)/30)
>>>    copy_VarCoords(paren(i,j,:,:),pot(i,j,:,:))
>>>    printVarSummary(pot(i,j,:,:))
>>>
>>> 
>>>;***********************************************************************
>>>********
>>> ; Creating NetCDF files for writing and put time UNLIMITED
>>> 
>>>;***********************************************************************
>>>********
>>>     print("Creating file
>>> ENSMEAN_Pre_pot_evap_"+year(i)+"_"+month(j)+".nc")
>>>
>>>       system("/bin/rm -f
>>> ENSMEAN_Pre_pot_evap_"+year(i)+"_"+month(j)+".nc")   ; remove any
>>> pre-existing file
>>>       pot_evap =
>>> addfile("ENSMEAN_Pre_pot_evap_"+year(i)+"_"+month(j)+".nc","c")  ;
>>> open output netCDF file
>>>
>>>
>>> ; make time and UNLIMITED dimension      ; recommended  for most
>>> applications
>>>     filedimdef(pot_evap,"time",-1,True)
>>>
>>> 
>>>;***********************************************************************
>>>*************************************
>>> ; Writing down in the NetCDF files
>>> 
>>>;***********************************************************************
>>>*************************************
>>>
>>> ; output variables directly
>>>     print("Writing down pet in
>>> ENSMEAN_Pre_pot_evap_"+year(i)+"_"+month(j)+".nc")
>>>
>>>        pot!2    = "latitude"                      ; assign named
>>> dimensions
>>>        pot!3    = "longitude"
>>>
>>>        pot&latitude  = refparam&latitude
>>>        pot&longitude = refparam&longitude
>>>
>>>        pot@long_name = "Potential Evap"           ; assign attributes
>>>        pot@units     = "mm/month"
>>>        pot_evap->pet   = pot
>>>
>>>    end do
>>>   end do
>>>
>>> end
>>> 
>>>------------------------------------------------------------------------
>>>----------------------------------------
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>
>
>------------------------------
>
>Message: 7
>Date: Mon, 27 Jan 2014 15:06:03 +0000
>From: Almami Johnson <almamij@gmail.com>
>Subject: Re: Writing netcdf files
>To: Dennis Shea <shea@ucar.edu>
>Cc: "ncl-talk@ucar.edu" <ncl-talk@ucar.edu>
>Message-ID:
>	<CAGDBja3yLRHxvP+=vT-nDBQ_omrh5u8dBMjayxU8vvZxrgFn-A@mail.gmail.com>
>Content-Type: text/plain; charset=ISO-8859-1
>
>Dear Dennis and Rick
>
>Thanks for your suggestions. I will try it in few minutes. Sorry that
>my question was not clear. What I actually meant is I want to save
>each time step (each month of a given year) in a new file. This is the
>reason why I thought I needed to loop. Should'nt I create these
>arrays?
>
>  paren    = new((/nyear,nmon,nlat,nlon/), "float")
>  sunshine = new((/nyear,nmon,nlat,nlon/), "float")
>  alpha    = new((/nyear,nlat,nlon/), "float")
>  pot      = new((/nyear,nmon,nlat,nlon/), "float")
>
>Thanks again
>regards
>
>On 1/27/14, Dennis Shea <shea@ucar.edu> wrote:
>> A few comments on your script:
>>
>> The following
>>
>> 
>>year=(/"1985","1986","1987","1988","1989","1990","1991","1992","1993","19
>>94","1995","1996","1997","1998","1999","2000","2001","2002","2003","2004"
>>/)
>> month=(/"01","02","03","04","05","06","07","08","09","10","11","12"/)
>>
>> could be replaced with
>>
>>     years  = tostring(ispan(1985,2004,1))    ; string
>>     months = sprinti("%0.2i", ispan(1,12,1))
>>     print(months)
>>
>> But, given the context of your use, I would suggest
>>     year   = ispan(1985,2004,1)              ; integer
>>     month  = ispan(1,12,1)                   ; integer
>>     months = sprinti("%0.2i", ispan(1,12,1)) ; string
>> or
>>
>>
>> =====
>> Remove this ... you do not have a dimension named 'time'
>>
>>  > ; make time and UNLIMITED dimension      ; recommended  for most
>> applications
>>  >      filedimdef(pot_evap,"time",-1,True)
>>
>> =====
>> As mentioned by RickB, your question is not very clear.
>>
>> You create arrays
>>
>>  >      paren    = new((/nyear,nmon,nlat,nlon/), "float")
>>  >      sunshine = new((/nyear,nmon,nlat,nlon/), "float")
>>  >      alpha    = new((/nyear,nlat,nlon/), "float")
>>  >      pot      = new((/nyear,nmon,nlat,nlon/), "float")
>>
>> Then you do a double 'do loop' and write each time step. Why
>>
>> I'd suggest you write one file at the end.
>>
>> =====
>>
>>
>> On 1/27/14, 6:44 AM, brownrig@ucar.edu wrote:
>>> Hi,
>>>
>>> I suspect you may need to explicitly close each NetCDF file after
>>> writing to it with a "delete(pot_evap)" at the end of your
>>> doubly-nested loop.
>>>
>>> As for the dimensions, I'm not clear on your intent, but from the
>>> loop, were you wanting something more like:
>>>
>>>      pot_evap->pet = pot(i,j,:,:)     ;; rather than "pot_eval->pet =
>>> pot"
>>>
>>> Hope that helps...
>>> Rick
>>>
>>>
>>>
>>> On Mon, 27 Jan 2014 10:58:40 +0000
>>>    Almami Johnson <almamij@gmail.com> wrote:
>>>> Dear  NCL users
>>>>
>>>> I'm trying to calculate monthly potential evapotranspiration based
>>>> on
>>>> Thornthwaite (1948). I have each monthly term in a file named
>>>> something.year.month.nc. I have created this script to output each
>>>> month for a given year in a file named output.year.month.nc.
>>>> The problem is all the output.year.month.nc are similar which makes
>>>> me
>>>> think NCL is writing the same thing in all the output files. Could
>>>> you
>>>> please take a look at this script and tell me what is wrong with it?
>>>> Another problem I'm facing is that the ncdump -h of the outputs
>>>> looks like this:
>>>>
>>>> dimensions:
>>>> 	time = UNLIMITED ; // (0 currently)
>>>> 	ncl1 = 20 ;
>>>> 	ncl2 = 12 ;
>>>> 	latitude = 180 ;
>>>> 	longitude = 280 ;
>>>> variables:
>>>> 	float pet(ncl1, ncl2, latitude, longitude) ;
>>>> 		pet:units = "mm/month" ;
>>>> 		pet:long_name = "Potential Evap" ;
>>>> 		pet:_FillValue = 9.96921e+36f ;
>>>>
>>>> My question is how to output without ncl1 and ncl2 dimensions and
>>>> have
>>>> the time like time = UNLIMITED ; // (1 currently)
>>>>
>>>> Thanks for your help
>>>> Almami
>>>>
>>>> 
>>>>-----------------------------------------------------------------------
>>>>--------------------------------------------
>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>>>>
>>>> begin
>>>>
>>>> 
>>>>;**********************************************************************
>>>>*******************
>>>> ; Creating Function to Read at once Precip and Convert Calendar to
>>>> Human Readable YYYYMM
>>>> 
>>>>;**********************************************************************
>>>>*******************
>>>>    undef("getPrecip")
>>>>    function getPrecip(fname[1]:string, vname[1]:string)
>>>>    local x
>>>>
>>>>    begin
>>>>      f       = addfile(fname, "r")
>>>>      x       = f->$vname$(0,0,{-10:35},{-30:40})  ; read specified
>>>> time period
>>>>    return(x)
>>>>    end
>>>>
>>>>    undef("getPrecip1")
>>>>    function getPrecip1(fname[1]:string, vname[1]:string)
>>>>    local y
>>>>
>>>>    begin
>>>>      f       = addfile(fname, "r")
>>>>      y       = f->$vname$(0,{-10:35},{-30:40})  ; read specified time
>>>> period
>>>>    return(y)
>>>>    end
>>>>
>>>> 
>>>>;**********************************************************************
>>>>*******************
>>>> ; Creating a new variable corresponding to all the 12 months and
>>>> getting each
>>>> 
>>>>;**********************************************************************
>>>>*******************
>>>>
>>>>
>>>>    reffile  = addfile("ENSMEAN_Pre_paren_2004_05.nc", "r")
>>>>    refparam = reffile->t2m(:,0,{-10:35},{-30:40})
>>>>    printVarSummary(refparam)
>>>>
>>>>    dim = dimsizes(refparam)
>>>>    ntime= dim(0)
>>>>    nlat = dim(1)
>>>>    nlon = dim(2)
>>>>
>>>>
>>>> 
>>>>year=(/"1985","1986","1987","1988","1989","1990","1991","1992","1993","
>>>>1994","1995","1996","1997","1998","1999","2000","2001","2002","2003","2
>>>>004"/)
>>>>    
>>>>month=(/"01","02","03","04","05","06","07","08","09","10","11","12"/)
>>>>    ndays=(/31,28,31,30,31,30,31,31,30,31,30,31/)
>>>>
>>>>    nyear= dimsizes(year)
>>>>    nmon = dimsizes(month)
>>>>
>>>>     paren    = new((/nyear,nmon,nlat,nlon/), "float")
>>>>     sunshine = new((/nyear,nmon,nlat,nlon/), "float")
>>>>     alpha    = new((/nyear,nlat,nlon/), "float")
>>>>     pot      = new((/nyear,nmon,nlat,nlon/), "float")
>>>>
>>>>
>>>>   do i = 0, nyear - 1
>>>>    do j = 0, nmon - 1
>>>>
>>>>    print("Getting data and preparing for " +year(i)+ " " +month(j)+ "
>>>> and for paren alpha and sunshine duration")
>>>>
>>>>    paren(i,j,:,:) =
>>>> getPrecip("ENSMEAN_Pre_paren_"+year(i)+"_"+month(j)+".nc","t2m")
>>>> printVarSummary(paren(i,j,:,:))
>>>>
>>>>    sunshine(i,j,:,:) =
>>>> getPrecip1("ENSMEAN_Pre_sund_"+year(i)+"_"+month(j)+".nc","sund")
>>>>    printVarSummary(sunshine(i,j,:,:))
>>>>
>>>>    alpha(i,:,:) = getPrecip("ENSMEAN_Pre_alpha_"+year(i)+".nc","t2m")
>>>>    printVarSummary(alpha(i,:,:))
>>>>
>>>>    print("Now taking potential evapotranspiration for " +year(i)+"
>>>> "+month(j)+ " and for paren alpha and sunshine duration")
>>>>
>>>>    pot(i,j,:,:) =
>>>> 
>>>>16*((paren(i,j,:,:))^(alpha(i,:,:)))*((sunshine(i,j,:,:))/12)*((ndays(j
>>>>))/30)
>>>>    copy_VarCoords(paren(i,j,:,:),pot(i,j,:,:))
>>>>    printVarSummary(pot(i,j,:,:))
>>>>
>>>> 
>>>>;**********************************************************************
>>>>*********
>>>> ; Creating NetCDF files for writing and put time UNLIMITED
>>>> 
>>>>;**********************************************************************
>>>>*********
>>>>     print("Creating file
>>>> ENSMEAN_Pre_pot_evap_"+year(i)+"_"+month(j)+".nc")
>>>>
>>>>       system("/bin/rm -f
>>>> ENSMEAN_Pre_pot_evap_"+year(i)+"_"+month(j)+".nc")   ; remove any
>>>> pre-existing file
>>>>       pot_evap =
>>>> addfile("ENSMEAN_Pre_pot_evap_"+year(i)+"_"+month(j)+".nc","c")  ;
>>>> open output netCDF file
>>>>
>>>>
>>>> ; make time and UNLIMITED dimension      ; recommended  for most
>>>> applications
>>>>     filedimdef(pot_evap,"time",-1,True)
>>>>
>>>> 
>>>>;**********************************************************************
>>>>**************************************
>>>> ; Writing down in the NetCDF files
>>>> 
>>>>;**********************************************************************
>>>>**************************************
>>>>
>>>> ; output variables directly
>>>>     print("Writing down pet in
>>>> ENSMEAN_Pre_pot_evap_"+year(i)+"_"+month(j)+".nc")
>>>>
>>>>        pot!2    = "latitude"                      ; assign named
>>>> dimensions
>>>>        pot!3    = "longitude"
>>>>
>>>>        pot&latitude  = refparam&latitude
>>>>        pot&longitude = refparam&longitude
>>>>
>>>>        pot@long_name = "Potential Evap"           ; assign attributes
>>>>        pot@units     = "mm/month"
>>>>        pot_evap->pet   = pot
>>>>
>>>>    end do
>>>>   end do
>>>>
>>>> end
>>>> 
>>>>-----------------------------------------------------------------------
>>>>-----------------------------------------
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> List instructions, subscriber options, unsubscribe:
>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>
>>
>
>
>------------------------------
>
>Message: 8
>Date: Mon, 27 Jan 2014 17:12:02 +0100
>From: Xi Chang <xi.chang01@gmail.com>
>Subject: simple daily anomalies
>To: "ncl-talk@ucar.edu" <ncl-talk@ucar.edu>
>Message-ID:
>	<CAGfRhtdsxa1B6X9AXFoMaF90s_NcC8CrXQbHOWM_AqVVXzD-QQ@mail.gmail.com>
>Content-Type: text/plain; charset="iso-8859-1"
>
>Hallo NCL folks,
>
>I was searching through all NCL functions, a function that can produce
>daily anomalies from 3D data without 'longitude' i.e. X [time, level, 
>lat].
>since clmDayTLL and clmDayTLLL still consider the longitude within the
>dataset.
>
>Thanks.
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: 
>http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140127/35c734c2/a
>ttachment.html 
>
>------------------------------
>
>Message: 9
>Date: Mon, 27 Jan 2014 17:46:08 +0100
>From: Xi Chang <xi.chang01@gmail.com>
>Subject: Re: simple daily anomalies
>To: "ncl-talk@ucar.edu" <ncl-talk@ucar.edu>
>Message-ID:
>	<CAGfRhtf=90n-O9fBGg-5SU+0+1R=zxDL_Js8WEPRSRpim4m5ag@mail.gmail.com>
>Content-Type: text/plain; charset="iso-8859-1"
>
>I followed the thread here
>http://www.ncl.ucar.edu/Support/talk_archives/2013/3227.html and do the
>same thing as follow:
>
>x [time,level,lat]
>
>dimx = dimsizes(x)
>ntim = dimx(0)
>klev = dimx(1)
>nlat = dimx(2)
>mlon=1
>
>xnew = conform_dims( (/ntim,klev,nlat,mlon/), x, 3)
>
>
>*then ERROR:fatal:conform_dims: The array to be conformed must have the
>same number of dimensions as indicated by the length of the last argument*
>
>
>Variable: x
>Type: float
>Total Size: 854976 bytes
>            213744 values
>Number of Dimensions: 3
>Dimensions and sizes:   [time | 366] x [level | 8] x [lat | 73]
>Coordinates:
>            time: [17067072..17075832]
>            level: [1000..300]
>            lat: [90..-90]
>Number Of Attributes: 19
>  long_name :   mean Daily relative humidity
>  unpacked_valid_range :        ( -25, 125 )
>  actual_range :        (  0, 100 )
>  units :       %
>  missing_value_original :      32766
>  precision :   2
>  least_significant_digit :     0
>  GRIB_id :     52
>  GRIB_name :   RH
>  var_desc :    Relative humidity
>
>
>I have no idea I always get this error,
>Thank you
>
>Chang
>
>
>On Mon, Jan 27, 2014 at 5:12 PM, Xi Chang <xi.chang01@gmail.com> wrote:
>
>> Hallo NCL folks,
>>
>> I was searching through all NCL functions, a function that can produce
>> daily anomalies from 3D data without 'longitude' i.e. X [time, level, 
>>lat].
>> since clmDayTLL and clmDayTLLL still consider the longitude within the
>> dataset.
>>
>> Thanks.
>>
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: 
>http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140127/c5e6cd4e/a
>ttachment.html 
>
>------------------------------
>
>Message: 10
>Date: Mon, 27 Jan 2014 11:57:39 -0500
>From: Alan Brammer <abrammer@albany.edu>
>Subject: Re: simple daily anomalies
>To: ncl-talk@ucar.edu <ncl-talk@ucar.edu>, Xi Chang
>	<xi.chang01@gmail.com>
>Message-ID: <etPan.52e69004.721da317.102dd@jasper.eas.albany.edu>
>Content-Type: text/plain; charset="utf-8"
>
>The developers will know more about this, but at least in version 6.1.2, 
>the functions you mentioned make no actual use of the names (anymore). 
>?You should be able to freely use the TLL version and the function will 
>not know whether its calculating over level*lat or lat*lon as it doesn?t 
>matter.?
>
>If you take a look 
>in?$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl ?at the clmDayTLL 
>function you should see that the main lines are now using dim_avg_n thus 
>the dimensions names are irrelevant.?
>
>
>Alan.
>
>
>
>##############################
>Alan Brammer
>PhD Student,
>
>Department of Atmospheric and?Environmental Sciences,
>University at Albany,?
>State University of New?York
>Albany, NY, 12222
>
>abrammer@albany.edu
>
>##############################
>
>
>On January 27, 2014 at 11:46:15 AM, Xi Chang (xi.chang01@gmail.com) wrote:
>
>I followed the thread here 
>http://www.ncl.ucar.edu/Support/talk_archives/2013/3227.html and do the 
>same thing as follow:
>
>x [time,level,lat]
>
>dimx = dimsizes(x)?
>ntim = dimx(0)
>klev = dimx(1)
>nlat = dimx(2)
>mlon=1
>
>xnew = conform_dims( (/ntim,klev,nlat,mlon/), x, 3)
>
>then ERROR:
>fatal:conform_dims: The array to be conformed must have the same number 
>of dimensions as indicated by the length of the last argument
>
>
>Variable: x
>Type: float
>Total Size: 854976 bytes
>??????????? 213744 values
>Number of Dimensions: 3
>Dimensions and sizes:?? [time | 366] x [level | 8] x [lat | 73]
>Coordinates:
>??????????? time: [17067072..17075832]
>??????????? level: [1000..300]
>??????????? lat: [90..-90]
>Number Of Attributes: 19
>? long_name :?? mean Daily relative humidity
>? unpacked_valid_range :??????? ( -25, 125 )
>? actual_range :??????? (? 0, 100 )
>? units :?????? %
>? missing_value_original :????? 32766
>? precision :?? 2
>? least_significant_digit :???? 0
>? GRIB_id :???? 52
>? GRIB_name :?? RH
>? var_desc :??? Relative humidity
>
>
>I have no idea I always get this error,
>Thank you
>
>Chang
>
>
>On Mon, Jan 27, 2014 at 5:12 PM, Xi Chang <xi.chang01@gmail.com> wrote:
>Hallo NCL folks,
>
>I was searching through all NCL functions, a function that can produce 
>daily anomalies from 3D data without 'longitude' i.e. X [time, level, 
>lat]. since clmDayTLL and clmDayTLLL still consider the longitude within 
>the dataset.
>
>Thanks.
>
>_______________________________________________  
>ncl-talk mailing list  
>List instructions, subscriber options, unsubscribe:  
>http://mailman.ucar.edu/mailman/listinfo/ncl-talk  
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: 
>http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140127/21a3874d/a
>ttachment.html 
>
>------------------------------
>
>Message: 11
>Date: Mon, 27 Jan 2014 17:29:12 +0000
>From: "Kumar, Anil (GSFC-617.0)[UNIV OF MARYLAND]"
>	<anil.kumar@nasa.gov>
>Subject: lat and lon grids
>To: "ncl-talk@ucar.edu" <ncl-talk@ucar.edu>
>Message-ID: <CF0C0196.7635%anil.kumar@nasa.gov>
>Content-Type: text/plain; charset="us-ascii"
>
>NCL folks,
>Please help me on this issue.
>I have single array of each  like lat, lon, lev, and time. I want to 
>create xlat_m and xlong_m   with   (time,lat,lon) as defined in the WRF  
>like this XLAT_M(Time, south_north, west_east)
>
> Data in the file looks like this
>
>dimensions:
>lon = 1160 ;
>lat = 490 ;
>lev = 1 ;
>time = UNLIMITED ; // (46 currently)
>variables:
>double lon(lon) ;
>lon:standard_name = "longitude" ;
>lon:long_name = "longitude" ;
>lon:units = "degrees_east" ;
>lon:axis = "X" ;
>double lat(lat) ;
>lat:standard_name = "latitude" ;
>lat:long_name = "latitude" ;
>lat:units = "degrees_north" ;
>lat:axis = "Y" ;
>double lev(lev) ;
>lev:long_name = "generic" ;
>lev:units = "level" ;
>lev:axis = "Z" ;
>double time(time) ;
>time:standard_name = "time" ;
>time:units = "hours since 2001-01-01 00:00:00" ;
>time:calendar = "standard" ;
>
>
>Thanks,
>Anil
>
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: 
>http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140127/0a02740b/a
>ttachment.html 
>
>------------------------------
>
>Message: 12
>Date: Mon, 27 Jan 2014 12:41:34 -0500
>From: Ioana Colfescu <colfescu@cola.iges.org>
>Subject: looping over a series of separate files
>To: ncl-talk@ucar.edu
>Message-ID: <52E69A4E.50309@cola.iges.org>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>Hi,
>
>I want to apply a series commands to every series of files ( X series of 
>files in total),that are in different directories and nothing to do with 
>each other.
>
>Using NCL and shell script is like :
>foreach model ( 1 2 3 4 5 )
>cat << EOR > tmp.ncl
>begin
>f=addfile("amoc_Cont${model}.nc","r")
>moc5=f1->AMOC
>....
>end
>EOR
>ncl tmp.ncl
>end
>
>But in this I keep the files/data separate and I use cshell too.
>My question is, if I want to do this just inside NCL and have all data 
>together (and not just write by hand f1=addgfile1,f2=addfile2 etc) 
>what's the syntax/way to do it in NCL ?.
>More exactly how do I create a loop that is something like
>
>do i=1,6
>f(i)=addfile("amoc_Cont(i).nc","r")
>...
>end
>
>The syntax I tried didn't work.
>
>Thanks,
>Ioana
>
>
>
>------------------------------
>
>Message: 13
>Date: Mon, 27 Jan 2014 12:48:38 -0500
>From: Ioana Colfescu <colfescu@cola.iges.org>
>Subject: looping over a series of separate files
>To: ncl-talk@ucar.edu, ncl-talk-request@ucar.edu
>Message-ID: <52E69BF6.8090304@cola.iges.org>
>Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
>
>Hi,
>
>I want to apply a series commands to every series of files ( X series of
>files in total),that are in different directories and nothing to do with
>each other.
>
>Using NCL and shell script is like :
>foreach model ( 1 2 3 4 5 )
>cat << EOR > tmp.ncl
>begin
>f=addfile("amoc_Cont${model}.nc","r")
>moc5=f1->AMOC
>....
>end
>EOR
>ncl tmp.ncl
>end
>
>But in this I keep the files/data separate and I use cshell too.
>My question is, if I want to do this just inside NCL and have all data
>together (and not just write by hand f1=addgfile1,f2=addfile2 etc)
>what's the syntax/way to do it in NCL ?.
>More exactly how do I create a loop that is something like
>
>do i=1,6
>f(i)=addfile("amoc_Cont(i).nc","r")
>...
>end
>
>The syntax I tried didn't work.
>
>Thanks,
>Ioana
>
>
>
>
>
>------------------------------
>
>Message: 14
>Date: Mon, 27 Jan 2014 11:52:03 -0600
>From: Kyle Griffin <ksgriffin2@wisc.edu>
>Subject: Re: looping over a series of separate files
>To: Ioana Colfescu <colfescu@cola.iges.org>
>Cc: ncl-talk <ncl-talk@ucar.edu>
>Message-ID:
>	<CAKt9o=gWYNJVzspe+PRp8OV2tSvuDV+vsyPFfhyFVMHaG62r5w@mail.gmail.com>
>Content-Type: text/plain; charset="iso-8859-1"
>
>Hi Ioana,
>
>In general, you will always be able to add an array of files via the
>addfiles command:
>
>http://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml
>
>I've put together a couple of lines below that should get you started in
>the correct direction (although I haven't tested it).
>
>model_num = ispan(1,5,1)
>file_path = "amoc_Cont"+model_num+".nc"
>f = addfiles(filepath,"r")
>
>At this point, f will be an array of size 5 with each file name at f[0],
>f[1], etc. Note the use of brackets [..] and NOT parenthesis (..) in your
>variable created by addfiles.
>
>
>Kyle
>
>----------------------------------------
>Kyle S. Griffin
>Department of Atmospheric and Oceanic Sciences
>University of Wisconsin - Madison
>Room 1421
>1225 W Dayton St, Madison, WI 53706
>Email: ksgriffin2@wisc.edu
>
>
>On Mon, Jan 27, 2014 at 11:41 AM, Ioana Colfescu 
><colfescu@cola.iges.org>wrote:
>
>> Hi,
>>
>> I want to apply a series commands to every series of files ( X series of
>> files in total),that are in different directories and nothing to do with
>> each other.
>>
>> Using NCL and shell script is like :
>> foreach model ( 1 2 3 4 5 )
>> cat << EOR > tmp.ncl
>> begin
>> f=addfile("amoc_Cont${model}.nc","r")
>> moc5=f1->AMOC
>> ....
>> end
>> EOR
>> ncl tmp.ncl
>> end
>>
>> But in this I keep the files/data separate and I use cshell too.
>> My question is, if I want to do this just inside NCL and have all data
>> together (and not just write by hand f1=addgfile1,f2=addfile2 etc)
>> what's the syntax/way to do it in NCL ?.
>> More exactly how do I create a loop that is something like
>>
>> do i=1,6
>> f(i)=addfile("amoc_Cont(i).nc","r")
>> ...
>> end
>>
>> The syntax I tried didn't work.
>>
>> Thanks,
>> Ioana
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>-------------- next part --------------
>An HTML attachment was scrubbed...
>URL: 
>http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140127/0a681107/a
>ttachment.html 
>
>------------------------------
>
>_______________________________________________
>ncl-talk mailing list
>ncl-talk@ucar.edu
>http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>End of ncl-talk Digest, Vol 122, Issue 28
>*****************************************
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jan 27 12:30:31 2014

This archive was generated by hypermail 2.1.8 : Fri Feb 07 2014 - 16:39:11 MST