Hi -
You can assign a time to a variable that has no time axis by adding
a variable with value zero defined at that time. Using your
one-point time axis,
define
axis/t="`t[g=swh,l=$1],return=tend`":"`t[g=swh,l=$1],return=tend`":1
time
let timestamp = 0* t[gt=time]
let var_with_time = var + timestamp
Ansley
On 3/18/2011 7:49 AM, Szymon Roziewski wrote:
Dear Hein,
Thank you for your help.
I tried out your solution but it doesn't work. I mean this chunk
of code
let swh_smooth_with_time = swh_smooth[gt=swh]
this one works fine
`t[g=swh,l=$1],return=tend`
I would expect the time information to still be here when you do
"list swh". Is that correct?
this time information are stuck there (in swh).
I tried this approach by defining a new grid with time axis but
it also doesn't work which looks odd for me.
let swh_smooth_t =
scat2gridgauss_xy(xp[i=1:`npts`],yp[i=1:`npts`],dp[i=1:`npts`],x[g=grid_xfine_yfine],y[g=grid_xfine_yfine],xscale,yscale,cutoff,0)
define
axis/t="`t[g=swh,l=$1],return=tend`":"`t[g=swh,l=$1],return=tend`":1
time
DEFINE AXIS/X=-5.666666667:5.25:0.010416667/unit=degree xfine
DEFINE AXIS/Y=-2.0:10.0:0.010416667/unit=degree yfine !1/8
DEFINE GRID/x=xfine/y=yfine/t=time grid_xfine_yfine1
let swh_smooth = swh_smooth_t[gxy=grid_xfine_yfine1,gt=time]
and also I checked
let swh_smooth = swh_smooth_t[gxyt=grid_xfine_yfine1]
Then I tested
define
axis/t="`t[g=swh,l=$1],return=tend`":"`t[g=swh,l=$1],return=tend`":1
time2
let swh_smooth = swh_smooth_t[gt=time2]
which also doesn't work.
But I worked around this problem by that chunk of code as dr Hein
wrote
let label_time = SUBSTRING("`t[g=swh,l=$1],return=tend`",0,17)
LABEL/NOUSER 1.1 `($ppl$ylen)+0.5` 0 0 .14 `label_time`
But I have no idea what to try out in case of changing time axis
or grid.
If someone would like to have a look at this file it is in
address: http://153.19.141.166/wam_2011031800.nc.tar.bz2
.
and needed part of script
DEFINE AXIS/X=-5.666666667:5.25:0.083333333/unit=degree xlon;\
DEFINE AXIS/Y=-2.0:10.0:0.083333333/unit=degree ylat;\
DEFINE GRID/x=xlon/y=ylat grid_xlon_xlat;\
DEFINE AXIS/X=-5.666666667:5.25:0.010416667/unit=degree xfine;\
DEFINE AXIS/Y=-2.0:10.0:0.010416667/unit=degree yfine !1/8;\
DEFINE GRID/x=xfine/y=yfine grid_xfine_yfine;\
let hstmp = hs[d=4]
let swh = hstmp[i=1:132,j=1:145,k=0,l=$1]
let xpts = xsequence(0*swh+x[g=swh])
let ypts = xsequence(0*swh+y[g=swh])
let datapts = xsequence(swh)
let xscale=0.1
let yscale=0.1
let cutoff=2
let xp = compressi(xpts)
let yp = compressi(ypts)
let dp = compressi(datapts)
let npts = dp[i=@ngd]
let swh_smooth_t =
scat2gridgauss_xy(xp[i=1:`npts`],yp[i=1:`npts`],dp[i=1:`npts`],x[g=grid_xfine_yfine],y[g=grid_xfine_yfine],xscale,yscale,cutoff,0)
kind regards,
Szymon Roziewski
2011/3/17 Hein Zelle <hein.zelle@xxxxxxxxxxxxx>
Hi Szymon,
> How can I grab the time label e.g. when I do the
command
> let swh = hstmp[i=1:132,j=1:145,k=0,l=$1] I loose
information about the time
> (i.e. 16-Jan-2011 01:00)
I would expect the time information to still be here when you
do
"list swh". Is that correct?
> and then when I smooth
> let swh_smooth =
>
scat2gridgauss_xy(xp[i=1:`npts`],yp[i=1:`npts`],dp[i=1:`npts`],x[g=grid_xfine_yfine],y[g=grid_xfine_yfine],xscale,yscale,cutoff,0)
> set var/title = "Significant Wave Height [m]"
swh_smooth
You've removed the time information here, because you're not
defining a
grid with a time axis for the new variable. Try re-assigning
a time
axis to variable swh_smooth, for example
let swh_smooth_with_time = swh_smooth[gt=swh]
You may have to define a new time axis with only 1 time step.
Alternatively, to plot a label you can use
`t[g=swh,l=$1],return=tend`
which gives you the formatted date/time string.
Kind regards,
Hein
--
Dr. Hein Zelle
Advisor Meteorology & Oceanography
Tel: +31 (0)527-242299
Fax: +31 (0)527-242016
Email: hein.zelle@xxxxxxxxxxxxx
Web: www.bmtargoss.com
BMT ARGOSS
P.O. Box 61, 8325 ZH Vollenhove
Voorsterweg 28, 8316 PT Marknesse
The Netherlands
----Confidentiality Notice & Disclaimer----
The contents of this e-mail and any attachments are intended
for the
use of the mail addressee(s) shown. If you are not that
person, you
are not allowed to read it, to take any action based upon it
or to
copy it, forward, distribute or disclose the contents of it
and you
should please delete it from your system. BMT ARGOSS does not
accept
liability for any errors or omissions in the context of this
e-mail or
its attachments which arise as a result of internet
transmission, nor
accept liability for statements which are those of the author
and
clearly not made on behalf of BMT ARGOSS.
--
Z wyrazami szacunku,
Szymon Roziewski
|