C Copyright(c) 1997, Space Science and Engineering Center, UW-Madison C Refer to "McIDAS Software Acquisition and Distribution Policies" C in the file mcidas/data/license.txt integer function setenhstr(area, iband, cstretch, idir) C *** $Id: setenhstr.f,v 1.5 2019/02/04 19:50:50 daves Exp $ *** implicit none integer iband integer area character*(*) cstretch integer idir(*) INCLUDE 'areaparm.inc' INCLUDE 'areacom.inc' INCLUDE 'imgdparm.inc' ! external functions INTEGER LUC INTEGER M0GETENV integer isan integer mccmdstr integer kb1opt integer kb2opt integer kb3opt integer lit character*4 clit ! local variables integer iarea integer iname(2) INTEGER ISTAT INTEGER ISLOT integer iopt integer ibuf(3) CHARACTER*12 cmd_stretch CHARACTER*12 env_stretch setenhstr = -1 call movcw(' ', iname) cmd_stretch = ' ' env_stretch = ' ' C--- CHECK IF AREA HAS BEEN OPENED DO 10 iarea=1,NAREA IF(AREAS(iarea).EQ.AREA) GOTO 20 10 CONTINUE setenhstr = -2 return 20 continue c--- Check for MCSTRETCH keyword and environment variable c--- First ensure this is not called from an ADDE server if(luc(-44) .eq. 0 .or. cstretch .ne. ' ') then ISTAT = M0GETENV('MCSTRETCH', ENV_STRETCH) CALL MCUPCASE(ENV_STRETCH) if(env_stretch .eq. ' ') env_stretch = 'EXP' istat = mccmdstr('MCS.TRETCH',1,env_stretch,CMD_STRETCH) endif if(cstretch .ne. ' ') cmd_stretch = cstretch C --- Ensure MCS= ORI or EXP C --- If not, set to EXP if(cmd_stretch(1:3) .ne. 'ORI' .and. & cmd_stretch(1:3) .ne. 'EXP' .and. & cmd_stretch(1:3) .ne. ' ' ) then call edest('Invalid setting for MCS: '//cmd_stretch,0) call edest('Using EXPanded stretch',0) cmd_stretch = 'EXP' endif islot = ncalb(2,iarea) ibuf(1) = iband ibuf(2) = ARADIR(3,NAREA) ! Get satid number ibuf(3) = 0 if( cmd_stretch(1:3) .eq. 'EXP') ibuf(3) = 1 iopt = lit('STR ') if(islot .eq. 1) istat = kb1opt(iopt, ibuf, iname) if(islot .eq. 2) istat = kb2opt(iopt, ibuf, iname) if(islot .eq. 3) istat = kb3opt(iopt, ibuf, iname) if(istat .eq. 0 .and. cmd_stretch(1:3) .eq. 'EXP') then if(clit(iname(1)).ne.' ') then call movw(2, iname, idir(EXP_BRIT_NAME1)) idir(EXP_BRIT_FLAG) = 1 endif endif setenhstr = istat RETURN END