c subroutine getinp include "flxproc.h" include "ccm.h" include "pltopt.h" character*8 fldname character*80 cmd integer unlink,rmcomments data fldname/' '/ namelist/input_sut/ + histvols, ! history volumes (mss paths) + mtimes, ! model times (day,hr,min) + cfields, ! requested fields + ccmlsd, ! ccm lsd file + iden,ionvel,modelhts, + iyaxright, ! right hand y-axis(es) flag + fmnmxint, ! field name, cmin, cmax, cint for each fld + cmin, ! field min to plot (from fmnmxint) + cmax, ! field max to plot (from fmnmxint) + cint, ! contour intervals (from fmnmxint) + fscale, ! fldname,scalefac for each field + scalefac, ! scale factor for each field (from fscale) + ivec_label, ! vector labeling (unused) + sendcgm, ! path to which cgm file is to be rcp'd + senddat, ! path to which ascii data file is to be rcp'd + sendps, ! path to which ps file to be sent + sendxdr, ! path to which xdr file to be sent + sendxdrms, ! mss path to which xdr file to be disposed c Maps: + ipltmaps, ! make maps + fmap_zpht, ! zp or ht surfaces + map_continents, ! draw continental outlines on maps + map_tn_unvn, ! add un+vn vectors to tn map + map_ht_unvn, ! add un+vn vectors to ht map + map_ep_uivi, ! add ui+vi vectors to epot map + ivec_label, ! label all vector arrows with magnitude + map_global, ! make cylindrical equidistant projection + map_global_cenlon, ! int center longitude for cyl equid + map_global_censlt, ! int center local time for cyl equid + map_polar, ! make polar stereographic projection + fmap_polar_perimlat, ! polar stereographic perimeter lats + map_satview, ! make satellite view projection + fmap_satview_latlon, ! float center lat and lon for satv + fmap_satview_latslt, ! float center lat and slt for satv + fmap_satview_eradii, ! float earth radii distance for satv + map_top_anno, ! top-of-frame annotation (80 char max) c Lat Slices: + ipltlat, ! make lat slices flag + flats, ! selected latitudes for lat slices + flat_zprange, ! zp ranges for y-axes of lat slices + flat_htscale, ! ht scales for y-axes of lat slices + ilat_log10, ! log10 flag for lat slices + lat_top_anno, ! top-of-frame annotation (80 char max) c Lon Slices: + ipltlon, ! make lon slices flag + flons, ! selected longitudes for lon slices + fslts, ! selected local times for lon slices + flon_zprange, ! zp ranges for y-axes of lon slices + flon_htscale, ! ht scales for y-axes of lon slices + ilon_log10, ! log10 flag for lon slices + lon_top_anno, ! top-of-frame annotation (80 char max) c Ut vs vert contours: + ipltutvert, ! flag for ut vs vertical contours + utvert_locs, ! lat,lon locations for ipltutvert + utvert_locname, ! char names of locations for ipltutvert + utvert_zprange, ! zprange(s) for ipltutvert + utvert_htscale, ! htscale(s) for ipltutvert + iutvert_log10, ! log10 flag for ipltutvert c Plt: + ibox_clabs, + icolor, + outplt, ! 'CGM' and/or 'PS' for plot output + multiplt, ! flag for multiple plots per frame + multiadvfr, ! frame adv flag for multiplt + ipltrowcol, ! number of rows,cols of plots per frame + psmode ! ps mode ('port' or 'land') c logical float_is_str c call clearstr(sendcgm) call clearstr(sendps) call clearstr(senddat) call clearstr(sendxdr) call clearstr(sendxdrms) call clearstr(map_top_anno) call clearstr(lat_top_anno) call clearstr(lon_top_anno) do ip=1,mxfproc cfields(ip) = ' ' enddo c c There are problems w/ f90 style namelist, even after comments c are removed (e.g., string literals not allowed in floats) c (f77 style stdin set by call assign in flxproc.f) c luinp = rmcomments(5,';',1) c read(luinp,input_sut,end=900,err=901,iostat=ios) read(5,input_sut,end=900,err=901,iostat=ios) c close(luinp) c c History volumes: c nhvols = 0 do i=1,mxhvols if (lenstr(histvols(i)).gt.0) nhvols = nhvols+1 enddo if (nhvols.le.0) then write(6,"(/72('-'))") write(6,"('ERROR: you must provide at least one history ', + 'volume name mss path')") write(6,"('For example:')") write(6,"(' histvols = ''/ROBLE/RGR95/VOLNAME''')") write(6,"(72('-')/)") stop 'histvols' endif if (nhvols.gt.mxhvols) then write(6,"(/72('-'))") write(6,"('WARNING: too many history volumes nhvols=',i4)") + nhvols nhvols = mxhvols write(6,"('Will use only the first ',i4,' volumes')") nhvols write(6,"(72('-')/)") endif c c Model times: c call chmtimes(mtimes,mxtms,ntms,ispval) write(6,"(' mtimes = '/3i4,(4(',',3i4)))") + ((mtimes(ii,i),ii=1,3),i=1,ntms) c c Check ccmsld: c lenccmlsd = lenstr(ccmlsd) if (lenccmlsd.le.0) then write(6,"(/'>>> Need ccmlsd name (ccm lsd data file)')") stop 'ccmlsd' endif c c Field flags and dependencies: c 9/96: cfields(mxfproc) has been read by getinp rather than ifields: c nbad = 0 c write(6,"('getinp: flab8=',/(8a8))") flab8 do ip=1,mxfproc lcfield = lenstr(cfields(ip)) if (lcfield.gt.0) then ifld = ixfindc(flab8,mxfproc,cfields(ip)) if (ifld.le.0) then write(6,"('>>> WARNING: field ',a,' is not a valid field')") + cfields(ip) cfields(ip) = ' ' nbad = nbad+1 else ifproc(ifld) = 1 endif endif enddo if (nbad.gt.0) then write(6,"('>>> There were unrecognized values in cfields.')") write(6,"(' A list of valid field names follows:')") write(6,"(8a8)") flab8 endif nf = 0 do ip=1,mxfproc if (ifproc(ip).gt.0) nf = nf+1 enddo if (nf.le.0) then write(6,"(/'>>> cfields contained no valid field names <<<')") stop 'cfields' endif do ip=1,mxfproc ixfhist(ip) = ifproc(ip) ! get fields requested by user enddo ixfhist(ixz) = 1 ! always get z if (modelhts.gt.0) ixfhist(ixz) = 2 if (map_tn_unvn.gt.0.and.ixfhist(ixt).gt.0) then ixfhist(ixu) = 1 ixfhist(ixv) = 1 endif if (map_ep_uivi.gt.0.and.ixfhist(ixepot).gt.0) then ixfhist(ixui) = 1 ixfhist(ixvi) = 1 endif c c Maps: c if (ipltmaps.eq.ispval) ipltmaps = 0 if (ipltmaps.gt.0) then nfmap_zpht = 0 do k=1,mxzpht if (fmap_zpht(k).ne.spval) nfmap_zpht = nfmap_zpht+1 enddo if (nfmap_zpht.le.0) then write(6,"('WARNING: need zp or ht surfaces for maps -- ', + 'turning ipltmaps off')") ipltmaps = 0 endif c c Center of ce proj: c if (map_global.gt.0) then if (map_global_cenlon.ne.ispval.and. + map_global_censlt.ne.ispval) then write(6,"('>>> cannot make map_global plots with both ', + 'cenlon and censlt -- will plot only with cenlon = ',i4, + ' (ignoring map_global_slt)')") map_global_cenlon write(6,"(' (next time if you want map_global_censlt, ', + 'comment out map_global_cenlon)')") map_global_censlt = ispval endif if (map_global_cenlon.eq.ispval.and. + map_global_censlt.eq.ispval) map_global_cenlon = 0 endif c c Center of sv proj (lat,lon or lat,slt): c Do either lat,lon center or lat,slt center, not both: c if (map_satview.gt.0) then if ((fmap_satview_latlon(1).ne.spval.and. + fmap_satview_latlon(2).eq.spval).or. + (fmap_satview_latlon(1).eq.spval.and. + fmap_satview_latlon(2).ne.spval)) then write(6,"('>>> need both lat and lon for ', + 'fmap_satview_latlon')") stop 'latlon' endif if ((fmap_satview_latslt(1).ne.spval.and. + fmap_satview_latslt(2).eq.spval).or. + (fmap_satview_latslt(1).eq.spval.and. + fmap_satview_latslt(2).ne.spval)) then write(6,"('>>> need both lat and slt for ', + 'fmap_satview_latslt')") stop 'latslt' endif if (fmap_satview_latlon(1).ne.spval.and. + fmap_satview_latslt(1).ne.spval) then write(6,"('>>> cannot make map_satview plots with both ', + ' latlon and latslt center of projection.')") write(6,"(' will plot only with lat,lon=',2f9.2)") + fmap_satview_latlon fmap_satview_latslt(1) = spval fmap_satview_latslt(2) = spval endif if (fmap_satview_latlon(1).eq.spval.and. + fmap_satview_latslt(1).eq.spval) then fmap_satview_latlon(1) = 40. fmap_satview_latlon(1) = 0. endif c c eradii distance: c if (fmap_satview_eradii.le.1.) then write(6,"('>>> bad fmap_satview_eradii: must be < 1.')") + fmap_satview_eradii write(6,"(' will default to 6.631')") fmap_satview_eradii = 6.631 endif endif endif ! ipltmaps=1 c c Check latitude slice zprange(s): c if (ipltlat.gt.0) then nzprange = 0 do j=1,mxvrange if (flat_zprange(1,j).ne.spval) nzprange = nzprange+1 if (flat_zprange(2,j).ne.spval) nzprange = nzprange+1 enddo if (nzprange.gt.0) then if (mod(nzprange,2).ne.0) then write(6,"(/'>>> flat_zprange must be *pairs* of floats: ', + 'I got ',i2,' values.')") nzprange stop 'flat_zprange' endif nzprange = nzprange/2 do i=1,nzprange if (flat_zprange(1,i).ge.flat_zprange(2,i)) then write(6,"('>>> bad flat_zprange = ',2f9.3,' -- skipping ', + 'this range')") (flat_zprange(ii,i),ii=1,2) flat_zprange(1,i) = spval flat_zprange(2,i) = spval nzprange = nzprange-1 endif enddo if (nzprange.le.0) then write(6,"('>>> no valid zpranges read -- will not ', + 'plot lat slices at zp scale')") endif endif c c Linear height scales for lat slices: c nhtscale = 0 do j=1,mxvrange do i=1,3 if (flat_htscale(i,j).ne.spval) nhtscale = nhtscale+1 enddo enddo if (nhtscale.gt.0) then if (mod(nhtscale,3).ne.0) then write(6,"(/'>>> flat_htscale must be *triplets* of floats: ', + 'I got ',i2,' values.')") nhtscale stop 'flat_htscale' endif nhtscale = nhtscale/3 do i=1,nhtscale if (flat_htscale(1,i).ge.flat_htscale(2,i)) then write(6,"('>>> bad flat_htscale = ',2f9.2,' -- skipping ', + 'this scale')") (flat_htscale(ii,i),ii=1,2) flat_htscale(1,i) = spval flat_htscale(2,i) = spval flat_htscale(3,i) = spval nhtscale = nhtscale-1 endif enddo if (nhtscale.le.0) then write(6,"('>>> no valid flat_htscale read -- will not ', + 'plot lat slices at linear height')") endif endif c c Check selected latitudes: c nlats = 0 do j=1,jmx if (flats(j).ne.spval) then if (flats(j).lt.-90..or.flats(j).gt.90.) then write(6,"('>>> bad flats=',f10.2,' -- skipping this ', + 'lat slice')") flats(j) flats(j) = spval endif else nlats = nlats+1 endif enddo c if (nlats.le.0) then write(6,"('>>> No valid flats read -- turning ipltlat', + ' off')") ipltlat = 0 endif if (nzprange.le.0.and.nhtscale.le.0) then write(6,"('>>> Did not read flat_zprange or flat_htscale', + ' -- turning ipltlat off')") ipltlat = 0 endif endif ! ipltlat.gt.0 c c Check longitude slice zprange(s): c if (ipltlon.gt.0) then nzprange = 0 do j=1,mxvrange if (flon_zprange(1,j).ne.spval) nzprange = nzprange+1 if (flon_zprange(2,j).ne.spval) nzprange = nzprange+1 enddo if (nzprange.gt.0) then if (mod(nzprange,2).ne.0) then write(6,"(/'>>> flon_zprange must be *pairs* of floats: ', + 'I got ',i2,' values.')") nzprange stop 'flon_zprange' endif nzprange = nzprange/2 do i=1,nzprange if (flon_zprange(1,i).ge.flon_zprange(2,i)) then write(6,"('>>> bad flon_zprange = ',2f9.3,' -- skipping ', + 'this range')") (flon_zprange(ii,i),ii=1,2) flon_zprange(1,i) = spval flon_zprange(2,i) = spval nzprange = nzprange-1 endif enddo if (nzprange.le.0) then write(6,"('>>> no valid zpranges read -- will not ', + 'plot lon slices at zp scale')") endif endif c c Linear height scales for lon slices: c nhtscale = 0 do j=1,mxvrange do i=1,3 if (flon_htscale(i,j).ne.spval) nhtscale = nhtscale+1 enddo enddo if (nhtscale.gt.0) then if (mod(nhtscale,3).ne.0) then write(6,"(/'>>> flon_htscale must be *triplets* of floats: ', + 'I got ',i2,' values.')") nhtscale stop 'flon_htscale' endif nhtscale = nhtscale/3 do i=1,nhtscale if (flon_htscale(1,i).ge.flon_htscale(2,i)) then write(6,"('>>> bad flon_htscale = ',2f9.2,' -- skipping ', + 'this scale')") (flon_htscale(ii,i),ii=1,2) flon_htscale(1,i) = spval flon_htscale(2,i) = spval flon_htscale(3,i) = spval nhtscale = nhtscale-1 endif enddo if (nhtscale.le.0) then write(6,"('>>> no valid flon_htscale read -- will not ', + 'plot lon slices at linear height')") endif endif c c Check selected longitudes: c nlons = 0 nslts = 0 do i=1,imx if (flons(i).ne.spval) then if (float_is_str(flons(i),'zm').or. + float_is_str(flons(i),'ZM')) then flons(i) = zmflag nlons = nlons+1 elseif (flons(i).lt.-180..or.flons(i).gt.180.) then write(6,"('>>> bad flons=',f10.2,' -- skipping this ', + 'lon slice')") flons(i) flons(i) = spval else nlons = nlons+1 endif endif c c Selected local times: c if (fslts(i).ne.spval) then if (fslts(i).lt.0..or.fslts(i).gt.24.) then write(6,"('>>> bad fslts=',f10.2,' -- skipping this ', + 'slt slice')") fslts(i) fslts(i) = spval else nslts = nslts+1 endif endif enddo c if (nslts.le.0.and.nlons.le.0) then write(6,"('>>> No valid flons read -- turning ipltlon', + ' off')") ipltlon = 0 endif if (nzprange.le.0.and.nhtscale.le.0) then write(6,"('>>> Did not read flon_zprange or flon_htscale', + ' -- turning ipltlon off')") ipltlon = 0 endif endif ! ipltlon.gt.0 c c Validate utvert_locs locations: c (on return from chlocs, if iutvertlocslt(i)=1, then that loc is c lat,slt) c (note zonal and global means are not allowed) c if (ipltutvert.gt.0) then irndgrid = 1 ! allow chlocs to round to nearest grid point iredund = 1 ! allow chlocs to remove redundant locations call chlocs(utvert_locs,mxlocs,gcmlat,gcmlon,jmx,imx,dlat,dlon, + zmflag,0,spval,iutvertlocslt,irndgrid,iredund,nloc) if (nloc.le.0) then write(6,"('>>> no valid locations for ipltutvert -- will ', + 'not make utvert plots')") ipltutvert = 0 endif endif if (ipltutvert.gt.0.and.ntms.lt.2) then write(6,"(/,'>>> Need at least 2 model times to make ', + 'ut vs zp/ht contours -- turning ipltutvert off')") ipltutvert = 0 endif c c Field cmin,cmax,cint, if requested: c (field name, cmin,cmax,cint are parsed from float fmnmxint(mxfproc)) c (note if cmin,cmax are specified for unvn or uivi, the values will c be used as vlc and vhc (vector low and high cutoff magnitudes) c c TODO: should use float_is_str as for fscale below c This and fscale below should be in lib/util for use by other codes. c n = 0 do ip=1,mxfproc do i=1,4 if (fmnmxint(i,ip).ne.spval) n = n+1 enddo enddo if (mod(n,4).ne.0) then write(6,"('>>> fmnmxint must be given in groups of 4')") write(6,"(' (field name string, cmin, cmax, cint)')") stop 'fmnmxint' endif if (n.gt.0) then do ip=1,mxfproc if (fmnmxint(1,ip).ne.spval) then write(6,"('ip=',i2,' fmnmxint(1,ip)=',a)") + ip,fmnmxint(1,ip) call clearstr(fldname) write(fldname,"(a)") fmnmxint(1,ip) do iip=1,mxfproc if (fldname(1:lenstr(fldname)).eq. + flab8(iip)(1:lenstr(flab8(iip)))) then cmin(iip) = fmnmxint(2,ip) cmax(iip) = fmnmxint(3,ip) cint(iip) = fmnmxint(4,ip) write(6,"('Field ',a,' cmin,cmax,cint=',3(1pe12.4))") + flab8(iip),cmin(iip),cmax(iip),cint(iip) goto 100 endif enddo write(6,"('>>> fmnmxint: could not find field name ',a)") + fldname write(6,"(' Must be one of the following:')") write(6,"(9a8)") flab8 fmnmxint(:,ip)=spval endif 100 continue enddo endif c c fscale(2,mxfproc) = pairs of floats for scale factor of each field: c 'fldname',scalefac. The scalefac(ip) is set from fscale(2,ip) and c passed to conpack ('SFS'=1./scalefac(ip) in each contour call). c (default fscale(:,mxfproc)=1. and scalefac(:)=1., as set in preset.f) c n = 0 do ip=1,mxfproc do i=1,2 if (fscale(i,ip).ne.1.) n = n+1 enddo enddo if (mod(n,2).ne.0) then write(6,"('>>> fscale must be given in groups of 2:')") write(6,"(' (field name string, scale_factor)')") stop 'fscale' endif if (n.gt.0) then do ip=1,mxfproc if (fscale(1,ip).ne.1.) then do iip=1,mxfproc if (float_is_str(fscale(1,ip),flab8(iip))) then scalefac(iip) = fscale(2,ip) write(6,"('field=',a,' fscale=', + e12.4)") flab8(iip),scalefac(iip) goto 200 endif enddo write(6,"('>>> fscale: could not find field name ',a)") + fscale(1,ip) write(6,"(' Must be one of the following:')") write(6,"(9a8)") flab8 fscale(:,ip)=1. 200 continue endif ! fscale(1,ip) == 1. enddo ! ip=1,mxfproc endif c c Do not make plots if no sendcgm or sendps is provided c (reduces cpu time for senddat only) c if (lenstr(sendcgm).le.0.and.lenstr(sendps).le.0) then mkplt = 0 multiplt = 0 c c Must provide at least on of senddat, sendcgm, sendps, sendxdr or c sendxdrms: c if (lenstr(senddat).le.0.and. + lenstr(sendxdr).le.0.and.lenstr(sendxdrms).le.0) then write(6,"(/72('-'))") write(6,"('>>> Need remote location to which data and/or ', + 'plots are to be sent:'/)") write(6,"('You must provide at least one of namelist ', + 'inputs sendcgm, sendps, senddat, or sendxdr:')") write(6,"('sendcgm = remote location to which metafile', + ' with plots is to be sent')") write(6,"(' (namelist outplt should include ', + '''cgm'')')") write(6,"('sendps = remote location to which postscript ', + 'file with plots is to be sent')") write(6,"(' (namelist outplt should include ', + '''ps'')')") write(6,"('senddat = remote location to which data file', + ' is to be sent')") write(6,"('sendxdr = remote location to which xdr data file', + ' is to be sent')") write(6,"('sendxdrms = remote mss path to which xdr file', + ' is to be sent')") write(6,"('These namelist inputs may be of the form ', + ' machine:path or machine:path/file, e.g.:')") write(6,"(' sendcgm = ', + '''vishnu.hao:/vishnu/d/foster/flxproc/flxproc.cgm''')") write(6,"(72('-')/)") stop 'nosend' endif endif c c Requested fields: c write(6,"(' cfields = ',$)") do ip=1,mxfproc lcf = lenstr(cfields(ip)) if (lcf.gt.0) write(6,"(a,' ',$)") cfields(ip)(1:lcf) enddo write(6,"(' ')") c c Plot options: c if (mkplt.gt.0) then write(6,"(' icolor = ',i2)") icolor write(6,"(' ibox_clabs = ',i2)") ibox_clabs write(6,"(' iboxplt = ',i2)") iboxplt write(6,"(' outplt = ',a,' ',a)") outplt write(6,"(' multiplt = ',i2)") multiplt if (multiplt.gt.0) then if (multiadvfr.ne.ispval) + write(6,"(' multiadvfr = ',i2)") multiadvfr write(6,"(' ipltrowcol = ',2i3)") ipltrowcol endif else write(6,"(/72('-'))") write(6,"('NOTE: NO PLOTS WILL BE MADE THIS RUN')") write(6,"(' ONLY DATA WILL BE RETURNED')") write(6,"('This is because senddat or senddatms or sendxdr ', + 'was given, but neither sendcgm or sendps were provided')") write(6,"(72('-')/)") endif c c Maps: c write(6,"(' ipltmaps = ',i2)") ipltmaps if (ipltmaps.gt.0) then write(6,"(' fmap_zpht = ',(7f8.1))") + (fmap_zpht(k),k=1,nfmap_zpht) write(6,"(' map_continents = ',i2)") map_continents write(6,"(' map_tn_unvn = ',i2)") map_tn_unvn write(6,"(' map_ht_unvn = ',i2)") map_ht_unvn write(6,"(' map_ep_uivi = ',i2)") map_ep_uivi write(6,"(' map_global = ',i2)") map_global if (lenstr(map_top_anno).gt.0) + write(6,"(' map_top_anno = ',a)") + map_top_anno(1:lenstr(map_top_anno)) if (map_global.gt.0) then if (map_global_cenlon.ne.ispval) then write(6,"(' map_global_cenlon = ',i4)") + map_global_cenlon elseif (map_global_censlt.ne.ispval) then write(6,"(' map_global_censlt = ',i3)") + map_global_censlt endif endif write(6,"(' map_polar = ',i2)") map_polar if (map_polar.gt.0) then write(6,"(' fmap_polar_perimlat = ',$)") do j=1,mxperimlat if (fmap_polar_perimlat(j).ne.spval) + write(6,"(f6.1,$)") fmap_polar_perimlat(j) enddo write(6,"(' ')") endif write(6,"(' map_satview = ',i2)") map_satview if (map_satview.gt.0) then if (fmap_satview_latlon(1).ne.spval) then write(6,"(' fmap_satview_latlon = ',2f9.2)") + fmap_satview_latlon else write(6,"(' fmap_satview_latslt = ',2f9.2)") + fmap_satview_latslt endif write(6,"(' fmap_satview_eradii = ',f9.3)") + fmap_satview_eradii endif endif c c Ascii data output file: c if (lenstr(senddat).gt.0) then iwrdat = 2 write(6,"('Will make ascii data file and rcp to ',a)") + senddat(1:lenstr(senddat)) endif c c Xdr file: c if (lenstr(sendxdr).gt.0.or.lenstr(sendxdrms).gt.0) then iwrxdr = 1 write(6,"('Will make xdr data file and rcp to ',a)") + sendxdr(1:lenstr(sendxdr)) endif c return c c Problem with namelist input: c Read nl output from luinp, and print out last line for hint as c to where error occurred: c 901 write(6,"('getinp: error from nml read: ios=',i6)") ios write(cmd,"('explain lib-',i4)") ios istat = ishell(cmd) call nlerr(luinp,'flxproc',url) 900 continue write(6,"('>>> getinp encountered EOF on stdin')") stop 'eof' end