c subroutine setyverts(zpspec_in,zpspec_out,nzpspec_out, + htspec_in,htspec_out,nhtspec_out, + mxspec,zp,nzp,dzp,spval,iprnt) c c Validate zp ranges in zpspec_in(2,mxspec) against zp(nzp), returning c valid ranges in zpspec_out, and number of valid ranges in nzpspec_out. c Also check ht scales in htspec_in(3,mxspec), returning valid htscales c in htspec_out, and number of valid scales in nhtspec_out. c real zpspec_in(2,mxspec),zpspec_out(2,mxspec),zp(nzp) real htspec_in(3,mxspec),htspec_out(3,mxspec) c nzpspec_out = 0 zpspec_out(:,:) = spval c c Check zp ranges first: c Loop over max number of ranges: c do j=1,mxspec if (zpspec_in(1,j).ne.spval.and. + zpspec_in(2,j).ne.spval) then nzpspec_out = nzpspec_out+1 c c Check bottom: c izp0 = ixfind(zp,nzp,zpspec_in(1,j),dzp) if (izp0.le.0) then if (iprnt.gt.0) + write(6,"('Reset bottom of zp axis from ',f5.1, + ' to bottom of vertical dimension at zp ',f5.1)") + zpspec_in(1,j),zp(1) zpspec_out(1,nzpspec_out) = zp(1) else zpspec_out(1,nzpspec_out) = zpspec_in(1,j) endif c c Check top: c izp1 = ixfind(zp,nzp,zpspec_in(2,j),dzp) if (izp1.le.0) then if (iprnt.gt.0) + write(6,"('Reset top of zp axis from ',f5.1, + ' to top of vertical dimension at zp ',f5.1)") + zpspec_in(2,j),zp(nzp) zpspec_out(2,nzpspec_out) = zp(nzp) else zpspec_out(2,nzpspec_out) = zpspec_in(2,j) endif endif c c End j=1,mxspec c enddo c c Next check ht scales: c Loop over max number of ranges: c nhtspec_out = 0 htspec_out(:,:) = spval do j=1,mxspec if (htspec_in(1,j).ne.spval.and.htspec_in(2,j).ne.spval.and. + htspec_in(3,j).ne.spval) then if (htspec_in(1,j).ge.htspec_in(2,j)) then write(6,"('>>> Bad htscale: htspec_in(1-2,j)=',2f9.2, + ' (bottom must be < top)')") + htspec_in(1,j),htspec_in(2,j) elseif (htspec_in(3,j).gt.htspec_in(2,j)-htspec_in(1,j)) then write(6,"('>>> Bad htscale: htspec_in(1-3,j)=',3f9.2, + ' (delta must be <= top minus bottom)')") + (htspec_in(i,j),i=1,3) else nhtspec_out = nhtspec_out+1 do i=1,3 htspec_out(i,j) = htspec_in(i,j) enddo endif endif c c End j=1,mxspec c enddo return end