IDL Programming for Adv ESCI
IDL Programming for Adv ESCI ESCI 386
Popular in Course
Popular in Earth Sciences
This 5 page Class Notes was uploaded by Cordie Miller on Thursday October 15, 2015. The Class Notes belongs to ESCI 386 at Millersville University of Pennsylvania taught by Staff in Fall. Since its upload, it has received 13 views. For similar materials see /class/223523/esci-386-millersville-university-of-pennsylvania in Earth Sciences at Millersville University of Pennsylvania.
Reviews for IDL Programming for Adv ESCI
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 10/15/15
ESCI 386 IDL Programming for Advanced Earth Sciences Applications Exercise 5 Inputoutput 1 The file exercise57inputtxt contains a header followed by records that contain a oating point value representing either a radius or a diameter and a string that indicates whether it is a radius or diameter Write an IDL main program that will do the following 0 Reads in the values from the input file 0 Uses the SPHEREO function you created in Exercise 3 to calculate both the surface area and volume of the sphere based on the value you read in 0 Creates a new file called exercise57outputtxt that will list the radiuses of the spheres for all the values you read in the surface area and the volumes Notes 0 The values in the output file should be sorted by radius from lowest to highest 0 The radius field should show 2 decimal places while the area and volume fields should show 1 decimal place The file should have a header showing the meaning and units of the values Hints 0 As you read in the values and the type of value diameter or radius put them into arrays Then you can convert the diameters to radiuses using the WHERE function and then you can sort the radiuses from smallest to largest Then loop through the array of radiuses calling your SPHERE function for each one twice once for surface area and once for volume Your output file should look like radius cm area ch2 volume ch3 00 00 004 00 00 023 0 7 01 8298 865280 23933654 8591 927465 26559496 9453 ll2292l 35383238 Turn in your program and the output file it created 2 Write an IDL program that will create a file that has the values of sine for all angles between 0 and 359 Format the output so that it looks like that below Turn in your program and the output file it created Hints Make your array of angles a 10 by 36 array This makes printing the rows a lot simpler Remember that the S IN function in IDL uses radians as its argument Your table should look like 0 1 2 3 4 5 6 7 8 9 0 00000 00175 00349 00523 00698 00872 01045 01219 01392 01564 10 l 01736 01908 02079 02250 02419 02588 02756 02924 03090 03256 20 l 03420 03584 03746 03907 04067 04226 04384 04540 04695 04848 30 l 05000 05150 05299 05446 05592 05736 05878 06018 06157 06293 320 l 70 6428 70 6293 70 6157 70 6018 705878 705736 70 5592 70 5446 70 5299 70 5150 330 l 70 5000 70 4848 70 4695 70 4540 704384 704226 70 4067 70 3907 70 3746 70 3584 340 l 70 3420 70 3256 70 3090 70 2924 70 2756 702588 70 2419 70 2250 70 2079 70 1908 350 l 70 1736 70 1564 70 1392 70 1219 701045 700872 70 0698 70 0523 70 0349 70 0175 ESCI 386 IDL Programming for Advanced Earth Sciences Applications Exercise 4 Geostrophic and Gradient Wind 1 Write an IDL function called GEOSTROPHI C that will accept three oating point arguments that represent a contour interval a distance between contours in kilometers and a latitude in degrees and that will return the geostrophic wind speed Include two keywords pre 5 sure and kriot s that do the following If the keyword pre 5 sure is set then the contour interval is assumed to be in millibars and the calculation is for the surface wind use an appropriate surface density Otherwise it is meters of geopotential height If the keyword knot s is set the output speed is in knots Otherwise it is in meters per second The geostrophic wind speed is given by 1 V 7 Vp fpr g v 7 rvzr 2 3 Write an IDL main program that calls your GEOSTROPHI C function and calculates and prints to the screen the geostrophic wind in knots for a 4 mb contour interval at 40 N latitude for contour spacings starting at 1000 km and decreasing in increments of 25 km down to a spacing of 25 km Note IDL may not like you passing a loop index variable to a function If so then just assign the loop index variable to a new variable and pass the new variable to your function h Write an IDL main program that calculates and prints to the screen the geostrophic wind in knots for a 4 mb contour interval and a contour spacing of 200 km for latitudes starting at 90 N and decreasing in 5 intervals down to a latitude of 0 3 Write an IDL procedure that will accept four oating point arguments that represent a contour interval a distance between contours in kilometers a radius of curvature in kilometers and a latitude in degrees and that will return the geostrophic and gradient wind Include the keywords knot s and pre 5 sure as in the geotstrophic function and an additional keyword ant i cycl one that acts as follows 0 If ant i cycl one is set the gradient wind for an anticyclone is calculated Otherwise the calculation is for a cyclone The gradient wind is given as R 4V Cyclone V f17g 1 gr 2 fR R 4 V Anticyclone Vg f21 1 fl where Vg is the geostrophic wind speed and R is the radius of curvature always positive in these formulas Notes 0 For anticyclonic ow it is possible for the radical to give an imaginary number which is unphysical If this happens set the gradient wind to NaN Include error checking so that if negative numbers are entered for any incoming arguments they are automatically converted to positives before doing any calculations 0 Your procedure M call the GEOSTROPHIC function to calculate the geostrophic wind ESCI 386 IDL Programming for Advanced Earth Sciences Applications Exercise 3 Procedures and Functions 1 Write an IDL function called SPHERE that will accept a oating point argument and two keywords Volume and di ameter The function will do the following 0 If the keyword volume is set the function returns the volume of the sphere If it is missing the function returns the surface area of the sphere 0 If the keyword di ameter is set the function assumes that the number you passed in is the diameter of the sphere If it is missing it assumes that the value is the radius of the sphere I want your code to be well formatted and commented appropriately 2 Write an IDL procedure called JUL IAN that will accept an integer argument that represents a Julian date and a single keyword leap7year The procedure will do the following 0 Return two values which are o a string containing the full name of the month corresponding to the Julian date o an integer containing the day of the month corresponding to the Julian date 0 If the keyword leap7year is set then February is assumed to have 29 days If the keyword is not set then February is assumed to have 28 days 0 If the user enters an invalid Julian date less than 1 or greater than 365 for a regular year or 366 for a leap year then have the procedure write an error message to the screen and have the procedure return l nval id Jul i an Date in place of the month string and a value of NaN for the day of the month integer 0 If the user enters a non integer Julian date have your procedure convert it to integer Notes 0 Your procedure will probably use a series of if then endif else if statements of the form if grade eq quotAquot then begin print quotWhooehooquot endif else if grade eq quotAquot then begin print quotAwesomequot endif else if grade eq quotBquot then begin print quotPretty darn goodquot endif else begin print quotBetter luck next timequot endelse though there are other ways of doing it
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'