c2--567--1---------2---------3---------4---------5---------6---------712 c Program terrpres c c -- Function: Given latitude (degrees North) and c longitude (degrees East) this program c determines and outputs the terrain pressure in Bar. c c -- Input & Output Variables real lat !latitude (degrees) (input) real lon !longitude (degrees) (input) real tpdat(360,720) ! 1/2 degree terrain pressure data ! (input) real tpout !terrain pressure for input !location (bar) (output) c c -- Local Variables c integer ilat, ilon logical normal c c Read surface pressure data c open (unit=1, file='terrain.txt', status='old', form='formatted') read (1, '(18f5.2)') tpdat close (1) c c Input latitude and longitude c write (*, *) write (*, *) 1 'When prompted, input latitude (degrees) & longitude (degrees)', 2 'and press enter: The output is terrain pressure (atmospheres)' write (*, *) write (*, *) 1 'For another location, repeat the process; ', 2 'to end the program, press cntl-c.' write (*, *) 100 write (*,*) 'lat, lon ?' read (*,*) lat, lon if ((lat .lt. -90.0) .or. (lat .gt. 90.0)) then write (*, *) 'lat must lie between -90.0 and 90.0' go to 100 end if if ((lon.lt. -180) .or. (lon .gt. 360)) then write (*, *) 'lon must lie between -180.0 and 180.0' go to 100 end if if (lon .gt. 180.0) lon=lon-360.0 ilat = int((lat+90.5)/0.5) if (ilat .eq. 361) ilat=360 ilon = int((lon+180.5)/0.5) if (ilon .eq. 721) ilon=720 tpout = tpdat(ilat,ilon) c c Output Terrain Pressure c write (*, *) 'Terrain pressure for latitude' write (*, '(x, f7.3)') lat write (*, *) 'and longitude' write (*, '(x, f7.3)') lon write (*, *) 'is' write (*, *) tpout go to 100 c end