[Thread Prev][Thread Next][Index]

Re: [ferret_users] constructing date strings like 19910825 instead of 25-AUG-1991



Hi,

I must be missing something... doesn't the "ZW" keyword in embedded expressions do the trick ?

def ax/t="10-jul-1987 12:00":"30-may-2016 12:00":1/unit=day/t0=1-jan-1900 t28y

let ymd = DAYS1900TOYMDHMS(t[gt=t28y])

def sym url0 http://data.remss.com

repeat/l=1:`ymd,ret=lend` (\
def sym path ccmp/v02.0/y`ymd[k=1],ZW=4`/M`ymd[k=2],ZW=2`;\
def sym fn CCMP_Wind_Analysis_`ymd[k=1],ZW=4``ymd[k=2],ZW=2``ymd[k=3],ZW=2`_V02.0_L3.0_RSS.nc;\
sp wget ($url0)/($path)/($fn);\
)

On Tue, 2017-01-31 at 17:45 +0900, Ryo Furue wrote:
Hi Billy and ferret users,

On Tue, Jan 31, 2017 at 4:57 PM, 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:

CCMP_Wind_Analysis_19910825_V02.0_L3.0_RSS.nc

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?

Would you be happy with a solution that combines ferret with another scripting language such as below?  The idea is to generate the filename outside and pass it to Ferret as an argument.


Ryo

----------------------------

# I just took it from the Internet and modified it.

# Run it as

#     $ sh thisscript

# on the command line.

#!/bin/sh
startdate=1987-01-01
#enddate=2016-05-31
enddate=1987-03-01

# GNU date command
#gdate=/usr/local/bin/gnu/date
gdate=gdate

curr="$startdate"
while true; do
    echo ferret -script yourscript.jnl "$curr" #<-- remove "echo" to run ferret
    [ "$curr" \< "$enddate" ] || break
    curr=$( $gdate +%Y-%m-%d --date "$curr +1 day" )
done




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

Privacy Policy | Disclaimer | Accessibility Statement