Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python 3 Write lambda functions to replace dir2cart() and cart2dir(). Call them dir_cart and cart_dir You measured a bedding plane with an azimuth of 40

python 3

  • Write lambda functions to replace dir2cart() and cart2dir(). Call them dir_cart and cart_dir
  • You measured a bedding plane with an azimuth of 40 and a plunge of 62. Use your function dir_cart() to convert the coordinates to cartesian coordinates.
  • Use your function cart_dir() to convert the cartesian coordinates back to polar coordinates
  • test your functions by calling the dir2cart() and cart2dir() funtions in the lecture.
  • modify cart2dir() to round to the nearest decimal
def dir2cart(Dir): """ converts polar directions to cartesian coordinates Inputs: Dir[Azimuth,Plunge]: directions in degreess Output: [X,Y,Z]: cartesian coordinates """ Az,Pl=np.radians(Dir[0]),np.radians(Dir[1]) return [np.cos(Az)*np.cos(Pl),np.sin(Az)*np.cos(Pl),np.sin(Pl)] def cart2dir(X): """ converts cartesian coordinates to polar azimuth and plunge Inputs: X: list of X,Y,Z coordinates Ouputs: [Az,Pl]: list of polar coordinates in degrees """ R=np.sqrt(X[0]**2+X[1]**2+X[2]**2) # calculate resultant vector length Az=np.degrees(np.arctan2(X[1],X[0]))%360. # calculate declination taking care of correct quadrants (arctan2) and making modulo 360. Pl=np.degrees(np.arcsin(X[2]/R)) # calculate inclination (converting to degrees) # return [Az,Pl]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Management Databases And Organizations

Authors: Richard T. Watson

2nd Edition

0471180742, 978-0471180746

More Books

Students also viewed these Databases questions

Question

What is the average number of bookings for each hotel in August?

Answered: 1 week ago

Question

Excel caculation on cascade mental health clinic

Answered: 1 week ago