Answered step by step
Verified Expert Solution
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started