Hi Vincent,
I'll add some more ideas below --
On 11/28/2012 10:00 AM, Vincent
Dujardin wrote:
Le 28/11/2012 18:22, Steve Hankin a
écrit :
On 11/28/2012 3:16 AM, Vincent
Dujardin wrote:
Hello ferret users,
I'm looking for some help with my ferret plot.
I have a first file with surface temperature data (t2) from
simulation, ploted along longitude (lon) and latitude (lat)
axis, for example at time 13:00 and with specified levels :
fill/l=13/lev=(280,270,0.5) T2,lon,lat
I also have measures stations and I want to plot their
locations over the map. I did that with a plot/over/vs lon,lat
from an ascii file with stations coordinates. It works very
well.
But what I want to do now, is to plot at each station location
the value the station measured using the same key as T2 and at
the same time, in order to see the difference between
simulation (2d data) and measures (1d data) for a given time.
The stations datas are stored in a different ascii file for
each stations in 2 columns (hours and temperatures).
hi Vincent,
To put text onto the plot like this you'll need to use something
like
REPEAT/i=1:[noOfStns] LABEL xpos,ypos text
(see http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/customizing-plots/LABELS#_VPINDEXENTRY_784
for details on controlling the label font, size, etc.)
Note that for each of the lat/lon positions of your stations,
you can get the exact interpolated value of the grid at that
location simply by using
LET exact_value =
myGriddedVar[X=`stnLon`,Y='stnLat`,T=`stnTime`]
DEFINE SYMBOL exact_value_string = `exact_value`
which means you can pretty easily label the gridded value, the
observed value and the difference if you so choose. The T
values must be formatted either as date strings, or as time
values in the encoding of your gridded variable. To get the
station observation times formatted as a date string have a look
at GO datestring.jnl
- Steve
Let's assume I have only 2 stations and time is a
list from 1 to 121 hours (5 days), how can I do that? I think
polygon might help since squares would give a better render
than points on the map, but I have no idea how to get that...
Thak you very much for answers.
Best regards
Vince
Thank you for your reply Steve. I hope I understood you. I
actually don't want to put text over my plot. I already added
labels located at specific lon,lat locations with stations names
(stat1 and stat2). The stations stat1 and stat2 datas are stored
in different files like this without headers:
date1 value1
date2 value2
date2 value3
... ...
I used the command "file" to get this with "show data":
1> ./stat1_T_2010 (default)
name title I J
K L
XVAR XVAR 1:1 1:1
... 1:121
YVAR YVAR 1:1 1:1
... 1:121
TVAR TVAR 1:1 1:1
... 1:121
V1 V1 1:1 1:1
... 1:121
with xvar the stat1 longitude, yvar the stat1 latitude, tvar the
dates (121 hours), v1 the temperatures. Same with data set 2 for
stat2.
I would like now to plot a square at xvar[d=1],yvar[d=1] and at
xvar[d=2],yvar[d=2] colorized with the value V1 at a given time L.
With plot/vs lon,lat I only have a dot or a cross showing the
location but I can't colorized it.
I hope you see better what I'd like to get with ferret.
Thank you again because I'm really lost...
Vincent
So, you need to read the station data and create a time axis for it,
then find which value matches the time you have plotted with
FILL/L=1 for the simulation data. The stations are at a constant
location, so it's a matter of defining only a time-axis grid for the
station data. Here's an outline of commands -- obviously I have not
tried these out so watch out for typo's.
I'd first open the simulation dataset which might look like this --
whatever grid the data is really on.
yes? show data
currently SET data sets:
1> ./simulation.nc
name title I
J K L
T2 variable title 1:360 1:180
... 1:132
LON longitude 1:360
1:180 ... 1:132
LAT latitude
1:360 1:180 ...
1:132
Define a time axis for your station data. Use the correct starting
date and hour for the station measurements - I just made up a time
origin here.
yes? define
axis/t/units=hours/t0="1-jan-2010:00:00" station_time =
tvar[d=2]
yes? define grid/t=station_time sgrid
yes? file/var="xvar,yvar,tvar,v1"/grid=sgrid stat1_t_2010
yes? show data 2
2> ./stat1_T_2010 (default)
name title I
J K L
XVAR XVAR 1:1
1:1 ... 1:121
YVAR YVAR 1:1
1:1 ... 1:121
TVAR TVAR 1:1
1:1 ... 1:121
V1 V1 1:1
1:1 ... 1:121
Now, you want to find the value of V1 to plot on your fill plot
at the same time as L=13 of the simulation data. Translate the time
into a date string. Then we can use that date string to get the
value of V1 at that same time.
yes? let time_point = t[gt=t2[d=1],L=13]
yes? let date_point = TAX_DATESTRING (13, t[gt=t2[d=1],
"hours")
yes? let v1value = v1[d=2,t=`date_point`]
Now, finally you can use the polygon command and the location xvar,
yvar from the station to put the polygon shape on your plot,
something like this-
yes? fill/l=13/lev=(280,270,0.5)
T2[d=1],lon[d=1],lat[d=1]
yes? let xlon = xvar[L=1]
yes? let ylat = yvar[L=1]
yes? go polymark poly/over/nokey/lev=(280,270,0.5)/nolab
xlon ylat v1value square
|