[Thread Prev][Thread Next][Index]
Re: [ferret_users] transect plot
Hi,
Another approach, depending on your dataset, might be to use a
great circle distance calculator (I've attached mine). You would set up
the GC variables using
go greatcircle
then identify the "origin" station with lon1,lat2 and all the stations
(including "origin")
with lon2,lat2. For example if your data profiles and their lon,lat
values were available along an x-axis (with depths along z) then
let lon1=mylon[i=1] ; let lat1=mylat[i=1]
let lon2=mylon ; let lat2=mylat
If you wanted a list of great circle distances in km and nm you would type
list gckm,gcnm
To go the next step of making a section plot with km or nm as the x-axis
variable you would regrid one to one (using @asn) the original data.
Suppose the profiles of the variable "mydata" were available on the grid
"grd" with axes (xax and zax say) and the lat,lon values were read in
along xax. The new x-axis would be defined like
def axis/x/from_data/name=xnm gcnm
to use the nautical mile coords available from the GC calculator. The
regridding would use
def grid/like=mydata/x=xnm newgrid
let newvar=myvar[g=newgrd,gx=@asn]
shade newvar
The first statements just substitutes the NM axis for the old x-axis
(xax) leaving zax (and yax and tax if they existed) untouched.
Statement 2 just places the original data on a nautical mile vs depth
grid, then we can shade or contour it.
Good luck,
Mick
PS I just type in the commands above without doing a demo, so beware of
typos.
PPS The attached script "greatcircle.jnl" has some notes at the end
suggesting how it might be used for other purposes with x-y gridded
data. There is another: "rhumbline.jnl" that defines Rhumb Line
variables and proves useful in other situations (in my worklife at least).
==============================
On 9/22/10 3:55 PM, Ansley Manke wrote:
hi -
Also, if you want to change from an axis in units of longitude to one
in units of meters, you will need to define the new axis yourself,
with meters corresponding to the longitudes and then regrid the data
to that new axis with @ASN. Ferret does not have tools to
automatically convert units of longitude to units of meters (except in
some internal computations such as averaging on the globe).
Ansley
On 9/22/2010 2:08 PM, Steve Hankin wrote:
See the script "vertical_section.jnl" and the function SAMPLEXY that
it uses.
On 9/22/2010 5:59 AM, golla nageswararao wrote:
Hi all,
I am having temperature-salinity data along a transect which is
perpendicular to coast (i.e., it is not along any latitude). I am
having lat, lon values also. I want to convert them into distances
(NM) in such a way that distances should be calculated with
reference to nearest station to the coast. How can I do this and
plot the temperature section with xaxis ranging from 0 to some NM ?
Thanks in advance.
--
With Best regards,
G.NageswaraRao.
! greatcircle : definitions for great circle calculations between
! two locations lon1,lat1 and lon2,lat2 (in degrees)
!
let d2r=atan(1.)/45
let rlon1=d2r*lon1 ; let rlat1=d2r*lat1
let rlon2=d2r*lon2 ; let rlat2=d2r*lat2
! define great circle distances from lon1,lat1 to lon2,lat2 in radians ...
let/title="Great Circle Distance (radians)" \
gcrad=acos(sin(rlat1)*sin(rlat2)+cos(rlat1)*cos(rlat2)*cos(rlon2-rlon1))
! ... and kilometers
let/title="Great Circle Distance (km)" gckm=111.11*gcrad/d2r
let/title="Great Circle Distance (nm)" gcnm=60*gcrad/d2r
! define initial heading from lon1,lat1 to lon2,lat2 (clockwise from north)
let gcharg=acos((sin(rlat2)-sin(rlat1)*cos(gcrad))/(sin(gcrad)*cos(rlat1)))
! correct for near north-south pairings
let gchfix=gcharg[x=@fln]/d2r
let/title="Initial Heading (degrees)" \
gchead=if(sin(rlon2-rlon1) gt 0)then gchfix else 360-gchfix
let lat=atan((tan(d2r*lat2)*sin(d2r*(lon-lon1))-tan(d2r*lat1)*sin(d2r*(lon-lon2)))/ \
sin(d2r*(lon2-lon1)))/d2r
! Usage: the results "gcrad", "gckm", and "gchead" are computed based on
! existing variables lon1,lat1 representing the start point and
! lon2,lat2 representing the destination.
!
! NOTE : To plot a greatcircle from lon1,lat1 to lon2,lat2 define a variable "lon"
! that spans the interval between them with sufficient resolution, for example
! def axis/x=`lon1`:`lon2`:0.1 xax ; let lon=x[gx=xax]
! plot/o/vs/nolab/line=2 lon,lat
! If a gridded file such as a topography is available it may be convenient to
! use that x-axis for "lon":
! let lon=x[g=...]
! plot/o/vs/nolab/line=2/x=`lon1`:`lon2` lon,lat
!
! rhumbline : definitions for rhumb line calculations between
! two locations lon1,lat1 and lon2,lat2 (in degrees)
!
let d2r=atan(1.)/45
let rlon1=d2r*lon1 ; let rlat1=d2r*lat1 ; let mlat1=d2r*(45+lat1/2)
let rlon2=d2r*lon2 ; let rlat2=d2r*lat2 ; let mlat2=d2r*(45+lat2/2)
! define rhumbline course from lon1,lat1 to lon2,lat2
let/title="Rhumb Line Heading (deg)" \
rlhead=mod(360-atan2(rlon1-rlon2,ln(tan(mlat2))-ln(tan(mlat1)))/d2r,360)
let/title="Rhumb Line Distance (km)"\
rlkm=111.32*(if(lat1 eq lat2)then abs(lon2-lon1)*cos(rlat1) else (lat2-lat1)/cos(d2r*rlhead))
let/title="Rhumb Line Distance (radians)"\
rlrad=rlkm/(111.32*d2r)
!
! to compute points on a rhumbline from (lon1,lat1) with distance "dist" at heading "dirn"
!
let rllat=LAT1+DIST*COS(D2R*DIRN)/111.32
let rllon=if(cos(d2r*dirn) eq 0)then dist/(111.32*cos(d2r*lat1)) else LON1-TAN(D2R*DIRN)*(LN(TAN(D2R*(45+LAT1/2)))-LN(TAN(D2R*(45+rllat/2))))/d2r
[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Privacy Policy | Disclaimer | Accessibility Statement