Subversion Repositories lagranto.ecmwf

Rev

Rev 3 | Rev 15 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3 Rev 9
Line 508... Line 508...
508
            var = 'INCIRCLE'
508
            var = 'INCIRCLE'
509
         elseif ( ivar.eq. -6 ) then
509
         elseif ( ivar.eq. -6 ) then
510
            var = 'INREGION'
510
            var = 'INREGION'
511
         elseif ( ivar.eq. -7 ) then
511
         elseif ( ivar.eq. -7 ) then
512
            var = 'TRIGGER'
512
            var = 'TRIGGER'
-
 
513
         elseif ( ivar.eq. -8 ) then
-
 
514
            var = 'VERT0'
513
         else
515
         else
514
            var=vars(ivar)
516
            var=vars(ivar)
515
         endif
517
         endif
516
         write(*,'(i5,f15.4,10x,a10)') i,out(i),trim(var)
518
         write(*,'(i5,f15.4,10x,a10)') i,out(i),trim(var)
517
 
519
 
Line 524... Line 526...
524
         if (imode.eq.4) mode='MIN'
526
         if (imode.eq.4) mode='MIN'
525
         if (imode.eq.5) mode='VAR'
527
         if (imode.eq.5) mode='VAR'
526
         if (imode.eq.6) mode='SUM'
528
         if (imode.eq.6) mode='SUM'
527
         if (imode.eq.7) mode='CHANGE'
529
         if (imode.eq.7) mode='CHANGE'
528
         if (imode.eq.8) mode='DIFF'
530
         if (imode.eq.8) mode='DIFF'
-
 
531
         if (imode.eq.9) mode='RANGE'
529
         write(*,'(i5,f15.4,10x,a10)') i,out(i),trim(mode)
532
         write(*,'(i5,f15.4,10x,a10)') i,out(i),trim(mode)
530
 
533
 
531
c        Get values
534
c        Get values
532
         i=i+1
535
         i=i+1
533
         nval=nint(out(i))
536
         nval=nint(out(i))
Line 540... Line 543...
540
            else
543
            else
541
               write(*,'(i5,f15.4,a2)') i,out(i),char(nint(out(i)))
544
               write(*,'(i5,f15.4,a2)') i,out(i),char(nint(out(i)))
542
            endif
545
            endif
543
         enddo
546
         enddo
544
 
547
 
545
c        Get times
548
c        Get the number of times
546
         i=i+1
549
         i=i+1
547
         ntim=nint(out(i))
550
         ntim=nint(out(i))
-
 
551
 
-
 
552
c        the number of times is variable - depending on TRIGGER
-
 
553
         if ( ntim .eq. -993 ) then
-
 
554
            write(*,'(i5,f15.4,7x,7x,a15)') i,out(i),'TIMES @ TRIGGER'
-
 
555
 
-
 
556
c        Get the detailed list of times
-
 
557
         else
548
         write(*,'(i5,f15.4,7x,7x,a6)') i,out(i),'#TIMES'
558
            write(*,'(i5,f15.4,7x,7x,a6)') i,out(i),'#TIMES'
549
         do j=1,ntim
559
            do j=1,ntim
550
            i=i+1
560
               i=i+1
551
            write(*,'(i5,f15.4,f7.0)') i,out(i),times(nint(out(i)))
561
               write(*,'(i5,f15.4,f7.0)') i,out(i),times(nint(out(i)))
552
         enddo
562
            enddo
-
 
563
         endif
553
 
564
 
554
c        Get time mode
565
c        Get time mode
555
         i=i+1
566
         i=i+1
556
         itime=nint(out(i))
567
         itime=nint(out(i))
557
         if (itime.eq.1) strtim='ALL'
568
         if (itime.eq.1) strtim='ALL'
Line 616... Line 627...
616
c        OUT      4     MIN      4       TRIGGER -i (i the trigger index)
627
c        OUT      4     MIN      4       TRIGGER -i (i the trigger index)
617
c        EQ       5     VAR      5
628
c        EQ       5     VAR      5
618
c        BEGIN   -1     SUM      6
629
c        BEGIN   -1     SUM      6
619
c        END     -2     CHANGE   7 
630
c        END     -2     CHANGE   7 
620
c        AND     -3     DIFF     8
631
c        AND     -3     DIFF     8
621
c        OR      -4     
632
c        OR      -4     RANGE    9
622
c        TRUE     6
633
c        TRUE     6
623
c        FALSE    7
634
c        FALSE    7
624
c        SPECIAL  0
635
c        SPECIAL  0
625
c        ALL      8 (TRIGGER)
636
c        ALL      8 (TRIGGER)
626
c        ANY      9 (TRIGGER)
637
c        ANY      9 (TRIGGER)
Line 634... Line 645...
634
c        INPOLYGON -3 : Specified polygon region
645
c        INPOLYGON -3 : Specified polygon region
635
c        INBOX     -4 : Longitude/latitude rectangle
646
c        INBOX     -4 : Longitude/latitude rectangle
636
c        INCIRCLE  -5 : Within a specified radius 
647
c        INCIRCLE  -5 : Within a specified radius 
637
c        INREGION  -6 : Within a specified rehion on the region file
648
c        INREGION  -6 : Within a specified rehion on the region file
638
c        TRIGGER   -7 : Trigger field
649
c        TRIGGER   -7 : Trigger field
-
 
650
c        VERT0     -8 : Vertical distance from starting position
639
c         
651
c         
640
c     For the special commands BEGIN, END, AND and OR, only one field
652
c     For the special commands BEGIN, END, AND and OR, only one field
641
c     in <out> is used.
653
c     in <out> is used.
642
 
654
 
643
      implicit none
655
      implicit none
Line 689... Line 701...
689
      integer      i,j
701
      integer      i,j
690
      integer      j1,j2
702
      integer      j1,j2
691
      integer      flag(ntimes)
703
      integer      flag(ntimes)
692
      integer      count
704
      integer      count
693
      integer      ok
705
      integer      ok
694
      integer      itrigger
706
      integer      itrigger,ttrigger
695
 
707
 
696
c     Common block for initialisation of polygon check
708
c     Common block for initialisation of polygon check
697
      real    tlonv(1000),vlat_c(1000),vlon_c(1000)
709
      real    tlonv(1000),vlat_c(1000),vlon_c(1000)
698
      real    xlat_c,xlon_c
710
      real    xlat_c,xlon_c
699
      integer ibndry,nv_c
711
      integer ibndry,nv_c
Line 786... Line 798...
786
        else
798
        else
787
           read(fid,*) nval
799
           read(fid,*) nval
788
           read(fid,*) (val(i),i=1,nval)
800
           read(fid,*) (val(i),i=1,nval)
789
        endif
801
        endif
790
 
802
 
791
c       Read times
803
c       Read times (on request, change to special trigger times)
792
        read(fid,*) ntim
804
        read(fid,*) ntim
-
 
805
        if ( ntim.eq.-993 ) then
-
 
806
           ttrigger = 1
-
 
807
           ntim     = 1
-
 
808
           tim(1)   = -999.
-
 
809
        else
-
 
810
           ttrigger = 0
793
        read(fid,*) (tim(i),i=1,ntim)
811
           read(fid,*) (tim(i),i=1,ntim)
-
 
812
        endif
794
        read(fid,*) tmode
813
        read(fid,*) tmode
795
 
814
 
796
c       Bring CAPITAL "TIME,LAT,LON,P" into "time,lat,lon,p"
815
c       Bring CAPITAL "TIME,LAT,LON,P" into "time,lat,lon,p"
797
        if (var.eq.'TIME') var='time'
816
        if (var.eq.'TIME') var='time'
798
        if (var.eq.'LAT' ) var='lat'
817
        if (var.eq.'LAT' ) var='lat'
Line 906... Line 925...
906
              ok = -5
925
              ok = -5
907
           elseif (var.eq.'INREGION') then
926
           elseif (var.eq.'INREGION') then
908
              ok = -6
927
              ok = -6
909
           elseif (var.eq.'TRIGGER') then
928
           elseif (var.eq.'TRIGGER') then
910
              ok = -7
929
              ok = -7
-
 
930
           elseif (var.eq.'VERT0') then
-
 
931
              ok = -8
911
           else
932
           else
912
             goto 400
933
             goto 400
913
          endif
934
          endif
914
        endif
935
        endif
915
        n=n+1
936
        n=n+1
Line 923... Line 944...
923
        if (mode.eq.'MIN'    ) ok=4
944
        if (mode.eq.'MIN'    ) ok=4
924
        if (mode.eq.'VAR'    ) ok=5
945
        if (mode.eq.'VAR'    ) ok=5
925
        if (mode.eq.'SUM'    ) ok=6
946
        if (mode.eq.'SUM'    ) ok=6
926
        if (mode.eq.'CHANGE' ) ok=7
947
        if (mode.eq.'CHANGE' ) ok=7
927
        if (mode.eq.'DIFF'   ) ok=8
948
        if (mode.eq.'DIFF'   ) ok=8
-
 
949
        if (mode.eq.'RANGE'  ) ok=9
928
        if (ok.eq.0) goto 400
950
        if (ok.eq.0) goto 400
929
        n=n+1
951
        n=n+1
930
        out(n)=real(ok)
952
        out(n)=real(ok)
931
 
953
 
932
c       Write the parameter values: INPOLYGON 
954
c       Write the parameter values: INPOLYGON 
Line 982... Line 1004...
982
              n=n+1
1004
              n=n+1
983
              out(n)=val(i)
1005
              out(n)=val(i)
984
           enddo
1006
           enddo
985
        endif
1007
        endif
986
 
1008
 
-
 
1009
c       Special time handling: only trigger times are cosidered
-
 
1010
        if ( ttrigger.eq.1 ) then
-
 
1011
           n = n+1
-
 
1012
           out(n)=-993.
-
 
1013
 
987
c       All times are selected
1014
c       All times are selected
988
        if ( abs(tim(1)+999.).lt.eps ) then
1015
        elseif ( abs(tim(1)+999.).lt.eps ) then
989
           n=n+1
1016
           n=n+1
990
           out(n)=real(ntimes)
1017
           out(n)=real(ntimes)
991
           do i=1,ntimes
1018
           do i=1,ntimes
992
              n=n+1
1019
              n=n+1
993
              out(n)=real(i)
1020
              out(n)=real(i)
Line 1190... Line 1217...
1190
      integer   flag
1217
      integer   flag
1191
      real      dist
1218
      real      dist
1192
      real      xcorner(4),ycorner(4)
1219
      real      xcorner(4),ycorner(4)
1193
      integer   iparam
1220
      integer   iparam
1194
      character ch
1221
      character ch
-
 
1222
      real      varmin,varmax
-
 
1223
      real      lev0,lev1
1195
 
1224
 
1196
c     Common block for initialisation of polygon check
1225
c     Common block for initialisation of polygon check
1197
      real    tlonv(1000),vlat_c(1000),vlon_c(1000)
1226
      real    tlonv(1000),vlat_c(1000),vlon_c(1000)
1198
      real    xlat_c,xlon_c
1227
      real    xlat_c,xlon_c
1199
      integer ibndry,nv_c
1228
      integer ibndry,nv_c
Line 1274... Line 1303...
1274
         enddo
1303
         enddo
1275
         
1304
         
1276
c        Get times (<time(j)> gets the row indices of <tra>)
1305
c        Get times (<time(j)> gets the row indices of <tra>)
1277
         i=i+1
1306
         i=i+1
1278
         nsel=nint(cmd(i))
1307
         nsel=nint(cmd(i))
-
 
1308
         if ( nsel .eq. -993 ) then
-
 
1309
            nsel = 0
-
 
1310
            do k=1,ntim
-
 
1311
              if ( trigger(k).ne.0 ) then
-
 
1312
                nsel       = nsel + 1
-
 
1313
                time(nsel) = k
-
 
1314
              endif
-
 
1315
           enddo
-
 
1316
         else
1279
         do j=1,nsel
1317
           do j=1,nsel
1280
            i=i+1
1318
              i=i+1
1281
            time(j)=nint(cmd(i))
1319
              time(j)=nint(cmd(i))
1282
         enddo
1320
           enddo
-
 
1321
         endif
-
 
1322
 
-
 
1323
c        If no times are selected, exit with non-select status
-
 
1324
         if ( nsel.eq.0 ) then
-
 
1325
             stack(1) = 0
-
 
1326
             goto 300
-
 
1327
         endif
1283
 
1328
 
1284
c        Get time mode
1329
c        Get time mode
1285
         i=i+1
1330
         i=i+1
1286
         itime=nint(cmd(i))
1331
         itime=nint(cmd(i))
1287
 
1332
 
Line 1374... Line 1419...
1374
         elseif ( ivar.eq. -7 ) then
1419
         elseif ( ivar.eq. -7 ) then
1375
            do j=1,nsel
1420
            do j=1,nsel
1376
               intvar(j) = trigger( time(j) ) 
1421
               intvar(j) = trigger( time(j) ) 
1377
            enddo
1422
            enddo
1378
         
1423
 
-
 
1424
c        Implicit variable: VERT0
-
 
1425
         elseif ( ivar.eq. -8 ) then
-
 
1426
            do j=1,nsel
-
 
1427
               lev0   = tra(1      ,4)
-
 
1428
               lev1   = tra(time(j),4)
-
 
1429
               var(j) = lev0 - lev1
-
 
1430
            enddo
1379
 
1431
 
1380
c        Explicit variable (column index <ivar>)
1432
c        Explicit variable (column index <ivar>)
1381
         else
1433
         else
1382
            do j=1,nsel
1434
            do j=1,nsel
1383
               var(j) = tra(time(j),ivar)
1435
               var(j) = tra(time(j),ivar)
Line 1432... Line 1484...
1432
               tmp=tmp+var(j)
1484
               tmp=tmp+var(j)
1433
            enddo
1485
            enddo
1434
            var(1)=tmp
1486
            var(1)=tmp
1435
            nsel=1
1487
            nsel=1
1436
            
1488
            
1437
c        Take CHANGE of the variable (change between first and last time)
1489
c        Take CHANGE of the variable (absolute difference between first and last time)
1438
         elseif (imode.eq.7) then
1490
         elseif (imode.eq.7) then
1439
            var(1)=abs(var(1)-var(nsel))
1491
            var(1)=abs(var(1)-var(nsel))
1440
            nsel=1
1492
            nsel=1
1441
 
1493
 
1442
c        Take DIFF of the variable (first minus last time)
1494
c        Take DIFF of the variable (first minus last time)
1443
         elseif (imode.eq.8) then
1495
         elseif (imode.eq.8) then
1444
            var(1)=var(1)-var(nsel)
1496
            var(1)=var(1)-var(nsel)
1445
            nsel=1
1497
            nsel=1
1446
 
1498
 
-
 
1499
c        Take RANGE of the variable
-
 
1500
         elseif (imode.eq.9) then
-
 
1501
            varmax=var(1)
-
 
1502
            varmin=var(1)
-
 
1503
            do j=2,nsel
-
 
1504
               if (var(j).gt.varmax) varmax=var(j)
-
 
1505
               if (var(j).lt.varmin) varmin=var(j)
-
 
1506
            enddo
-
 
1507
            var(1) = varmax - varmin
-
 
1508
            nsel=1
1447
         endif
1509
         endif
1448
 
1510
 
1449
c        --- Apply the operators to the single values ---
1511
c        --- Apply the operators to the single values ---
1450
 
1512
 
1451
         do j=1,nsel
1513
         do j=1,nsel