[Thread Prev][Thread Next][Index]

Re: [ferret_users] diagonal section



Hi,
the following script should help to do what you want. Searching the web will reveal similar tools. Please be aware that the earth radius may be not accurate enough for some purposes.
Best,
Martin

\can mode verify
! find the great circle distance between 2 points using the law of cosines
! 4 input arguments specify the (decimal) latitudes/longitudes of the points
! arg1=latitude 1
! arg2=longitude 1 (pos E)
! arg3=latitude 2
! arg4=longitude 2 (pos (E)

let pd=4*atan(1)/180
let rearth=6371.2   ! radius of the earth in km

! latitude must start from N pole (textbook law of cosines)
let latt1=90-$1
let latt2=90-$3

! convert spherical to Cartesian coordinates
let x1=sin(pd*latt1)*cos(pd*$2)
let y1=sin(pd*latt1)*sin(pd*$2)
let z1=cos(pd*latt1)
let x2=sin(pd*latt2)*cos(pd*$4)
let y2=sin(pd*latt2)*sin(pd*$4)
let z2=cos(pd*latt2)

let d1=(((x1 - x2)^2) + ((y1 - y2)^2)) + ((z1 - z2)^2)
let angle=acos(1-d1/2)        ! angular distance between the points
let distance=rearth*angle    ! distance on the sphere

!say `distance` km
set mode verify


Am 29.03.2017 um 15:10 schrieb Osinski, Robert FORNATL, PL:
Martin, Ruo,
I'll play with script vertical_section.jnl. Is it possible to have distance (from the first point [km]) on X axis instated of number of point using vertical_section script?
thanks,
Robert
 

From: owner-ferret_users@xxxxxxxx [owner-ferret_users@xxxxxxxx] on behalf of Ryo Furue [furue@xxxxxxxxxx]
Sent: Tuesday, March 28, 2017 9:14 AM
To: Martin Schmidt
Cc: ferret users
Subject: Re: [ferret_users] diagonal section

Martin and Robert,

Hi, concerning the first question I would like to draw your attention to the script

script vertical_section.jnl


That's excellent! So, it generates the diagonal and uses SAMPLEXY .  It's a perfect solution to the original question.

Ryo
 

More details on

http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/variables-xpressions/XPRESSIONS

Greetings,
Martin
Am 28.03.2017 um 14:30 schrieb Ryo Furue:
Hi Robert,

I know how to draw vertical sections along the grid line but how to make picture of diagonal section between two points for instance between (5,5) and (15,25).

I don't have a complete answer, but if you can generate a set of points forming the diagonal, you can accomplish what you need, by using the function samplexy .

The second question is how to do the same diagonal section of velocity perpendicular to this section having only components of velocity along axis

Because you know the angle of the diagonal line, you can compute the component of velocity perpendicular to the line by

  let vn = (-1)*u*sin(angle) + v*cos(angle)

Once you have computed the normal component of the velocity like this, you can again use the samplexy function to get the slice of the velocity field along the line.

(I haven't looked at your netCDF file . . . .)

Regards,

Ryo




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

Privacy Policy | Disclaimer | Accessibility Statement