[Thread Prev][Thread Next][Index]

[ferret_users] constructing output file names with zero-filled current date string

I need to extract the current date and use it in my output file name. How do I convert:


    current_date =” 2-Apr-18”


to a fix length, zero-filled date string: cDate=“02-Apr-18”?  

(Not an issue when the days of the month are higher than 10.)

I could remove the space:

DEF SYM cDate=($current_date)

PPL SET cdate $EDIT(cDate,compress)


to get cdate="2-Apr-18" but I'd like to have the zero-filled date



--- Peng

On Tue, Jan 31, 2017 at 2:57 AM, William Kessler <william.s.kessler@xxxxxxxx> wrote:
RSS has released a new version (v2) of the CCMP wind product, consistently analyzed from Jul 1987 through May 2016 (http://www.remss.com/measurements/ccmp). As far as I can tell, this is only available from them, and only by ftp-ing the individual daily files.

The whole global, 28-year fields are more than 285Gb. I want to write a script that will loop through the 10563 days, make daily averages from the four 6-hr values in each file, select my region of interest, and append that to a much smaller file (then delete the ftp-ed file).

(Yes, I'll probably have to run it in chunks over several nights).

My problem is to generate the filenames, which look like the example below:


It's pretty straightforward to define a daily time axis spanning the CCMP dates, REPEAT-loop on the days, and come up with the year/month/day number needed for the filename (e.g. DAYS1900TOYMDHMS). But can anyone sugest a simple way to construct the filename given the need to have leading zeroes for months before October and days of the month less than 10?

I am wishing for the equivalent to TAX_DATESTRING that would produce, e.g., 19910825 instead of 25-AUG-1991.

Billy K


Ge Peng, PhD
Research Scholar
Cooperative Institute for Climate and Satellites - NC (CICS-NC)/NCSU at

NOAA’s National Centers for Environmental Information (NCEI)

Center for Weather and Climate (CWC)

151 Patton Ave, Asheville, NC 28801
+1 828 257 3009; ge.peng@xxxxxxxx

ORCID: http://orcid.org/0000-0002-1986-9115

Following CICS-NC on Facebook

[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement