[Thread Prev][Thread Next][Index]

Re: [ferret_users] netcdf



Hello,
Going back to this email of a couple of weeks back.

The original question is about appending to a file in the T direction.  The script looks correct, however the data in each input file must be put onto a time axis with the variables from file 1 at timestep 1, the data in file 2 at timestep 2, etc.  In Ferret we call this adding a "timestamp".

http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/commands-reference/SAVE#timestamp

You've defined a time axis; what is needed is
def axis/t0=15-May-2009/t=1:23:1/unit=hours tax
LET timestamp = T[G=tax] * 0 !always 0
Then inside the REPEAT, we add this time variable to the variables, and then write out the particular time step we want.
let lat1_value=..botlat;\
let lat1 = lat1_value + timestamp;\
list/app/file=daytime8_ma20.nc/format=cdf/clob/l=`yy` lat1,...

For the other question about IF statements inside a repeat loop, when the contents of a REPEAT are long or complex, often the best solution is to write a second script which is called in the loop

   repeat/range=($start):($end)/name=yy (define symbol yval = `yy`;  go add_data.jnl)

and then the script contains all the commands, but with the symbol ($yval) representing the particular value in question.

-Ansley


On 5/17/2013 6:33 AM, Akshay Hegde wrote:

its because filename is same for through out the repeat

use like this
list/file=test_($yy).nc/clobber your variable

On May 17, 2013 4:34 PM, "Gopal Mondal" <gopalmondal18@xxxxxxxxx> wrote:

I am using vertical profile nc data.taking some of the global attributes I want to make another nc data file. my .jnl scripts is as bellow:
def symb start=1
def symb end=23
def axis/t0=15-May-2009/t=1:23:1/unit=hours tax
repeat/range=($start):($end)/name=yy (;\
use daytime8.`yy`.nc;\
let lat1=..botlat;\
let lat2=..edmaxlat;\
let lon1=..botlon;\
let lon2=..edmaxlon;\
let month=..month;\
let edmax=..edmax;\
let lct=..botlct;\
let day=..day;\
if `yy eq 1` then ;\
list/file=daytime8_ma20.nc/format=cdf/clob/l=`yy`/llimits=1:23 lat1,lat2,lon1,lon2,month,day,lct,edmax;\
else ;\
list/app/file=daytime8_ma20.nc/format=cdf/clob/l=`yy` lat1,lat2,lon1,lon2,month,day,lct,edmax;\
endif ;\
can da/all ;\
)
data file daytime8_ma20.nc created but with the parameters of 23(i.e. last data file) data file. But in a .dat the parameters of all 23 data file are created saved(if I remove the 'format=cdf" command).

Also I want to make a nc file with minlat<lat1,lat2<maxlat and minlon<lon1,lon2<maxlon with these 23 data file with a .jnl file as bellow:
def symb start=1
def symb end=2240
def axis/t0=1-Jan-2008/t=1:23:1/unit=hours tax
repeat/range=($start):($end)/name=yy (;\
use nighttime8.`yy`.nc;\
let lat1=..botlat;\
let lat2=..edmaxlat;\
let lon1=..botlon;\
let lon2=..edmaxlon;\
let month=..month;\
let edmax=..edmax;\
let lct=..botlct;\
let day=..day;\
let glat1=if lat1 lt 17 then 0 else lat1 ;\
let glon1=if lon1 lt 83 then 0 else lon1 ;\
let glat2=if lat2 lt 17 then 0 else lat2 ;\
let glon2=if lon2 lt 83 then 0 else lon2 ;\
if `glat1 le 27 and glon1 le 93` then ;\
list/file=nighttime8_ma19.nc/format=cdf/clob/l=`yy`/llimits=1:23 glat1,glon1,glat2,glon2,month,day,lct,edmax;\
elif `glat2 le 27 and glon2 le 93` then;\
list/app/file=nighttime8_ma19.nc/format=cdf/clob/l=`yy` glat1,glon1,glat2,glon2,month,day,lct,edmax;\
else ;\
list/file=nighttime8_ma20.dat/head/clob/l=`yy` glat1,glon1,glat2,glon2,month,day,lct,edmax;\
endif ;\
can da/all ;\
)

I think in last .jnl scripts the if -then else have some problem. Ples.any one help me.


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

Privacy Policy | Disclaimer | Accessibility Statement