Changeset 2214 in lmdz_wrf
- Timestamp:
- Nov 5, 2018, 7:16:03 PM (6 years ago)
- Location:
- trunk/tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/diag_tools.py
r2213 r2214 1394 1394 dy = hgt.shape[0] 1395 1395 1396 hgtmaxt, pthgtmaxt, dhgtt, peakst, valleyst, ofacest, ffacest = \ 1396 hgtmaxt, pthgtmaxt, dhgtt, peakst, valleyst, ofacest, ffacest, rnghgtmaxt, \ 1397 ptrnghgtmaxt = \ 1397 1398 fdin.module_fordiagnostics.compute_range_faces(lon=lon[:].transpose(), \ 1398 1399 lat=lat[:].transpose(), hgt=hgt[:].transpose(), face=face, nfilt=Nfilt, \ … … 1405 1406 origfaces = ofacest.transpose() 1406 1407 filtfaces = ffacest.transpose() 1408 rangeshgtmax = rnghgtmaxt.transpose() 1409 ptrangeshgtmax = ptrnghgtmaxt.transpose() 1407 1410 else: 1408 1411 print errormsg … … 1412 1415 1413 1416 return hgtmax, pthgtmax, dhgt, peaks, valleys, origfaces, filtfaces, vardims, \ 1414 varvdims 1417 varvdims, rangeshgtmax, ptrangeshgtmax 1415 1418 1416 1419 ####### ###### ##### #### ### ## # END Fortran diagnostics -
trunk/tools/diagnostics.py
r2213 r2214 704 704 705 705 orogmax, ptorogmax, dhgt, peaks, valleys, origfaces, diagout, diagoutd, \ 706 diagoutvd = diag.Forcompute_range_faces(lon, lat, hgt, face, Nptfilt,\707 Nptnewrange, dnamesvar, dvnamesvar)706 diagoutvd, rngorogmax, ptrngorogmax = diag.Forcompute_range_faces(lon, lat,\ 707 hgt, face, Nptfilt, Nptnewrange, dnamesvar, dvnamesvar) 708 708 709 709 # Removing the nonChecking variable-dimensions from the initial list … … 717 717 if face == 'WE': axis = 'lon' 718 718 elif face == 'SN': axis = 'lat' 719 720 ncvar.insert_variable(ncobj, 'orogmax', rngorogmax, diagoutd, diagoutvd, \ 721 newnc) 722 newnc.renameVariable('orogmax', 'rangeorogmax') 723 ovar = newnc.variables['rangeorogmax'] 724 ncvar.set_attribute(ovar, 'deriv', axis) 725 stdn = ovar.standard_name 726 ncvar.set_attribute(ovar, 'standard_name', 'range_' + stdn) 727 Ln = ovar.long_name 728 ncvar.set_attribute(ovar, 'long_name', 'range ' + stdn) 729 730 ncvar.insert_variable(ncobj, 'ptorogmax', ptrngorogmax, diagoutd, diagoutvd, \ 731 newnc) 732 newnc.renameVariable('ptorogmax', 'rangeptorogmax') 733 ovar = newnc.variables['rangeptorogmax'] 734 ncvar.set_attribute(ovar, 'deriv', axis) 735 stdn = ovar.standard_name 736 ncvar.set_attribute(ovar, 'standard_name', 'range_' + stdn) 737 Ln = ovar.long_name 738 ncvar.set_attribute(ovar, 'long_name', 'range ' + stdn) 719 739 720 740 ncvar.insert_variable(ncobj, 'orogmax', orogmax, diagoutd, diagoutvd, \ -
trunk/tools/module_ForDiagnostics.f90
r2213 r2214 950 950 951 951 SUBROUTINE compute_range_faces(d1, d2, lon, lat, hgt, face, Nfilt, newrange, hgtmax, pthgtmax, & 952 derivhgt, peaks, valleys, origfaces, filtfaces )952 derivhgt, peaks, valleys, origfaces, filtfaces, rangeshgtmax, ptrangeshgtmax) 953 953 ! Subroutine to compute faces [uphill, valleys, downhill] of a mountain range along a given face 954 954 … … 958 958 REAL(r_k), DIMENSION(d1,d2), INTENT(in) :: lon, lat, hgt 959 959 CHARACTER(len=*) :: face 960 REAL(r_k), DIMENSION(d1,d2), INTENT(out) :: derivhgt, hgtmax 960 REAL(r_k), DIMENSION(d1,d2), INTENT(out) :: derivhgt, hgtmax, rangeshgtmax 961 961 INTEGER, DIMENSION(d1,d2), INTENT(out) :: pthgtmax, origfaces, filtfaces, peaks, & 962 valleys 963 962 valleys, ptrangeshgtmax 964 963 ! Local 965 964 INTEGER :: i, j 966 INTEGER :: pthgtmax1, Npeaks, Nvalleys 965 INTEGER :: pthgtmax1, Npeaks, Nvalleys, Nranges 967 966 REAL(r_k) :: hgtmax1 968 INTEGER, DIMENSION(d1) :: ipeaks1, ivalleys1 969 INTEGER, DIMENSION(d2) :: ipeaks2, ivalleys2 967 INTEGER, DIMENSION(d1) :: ipeaks1, ivalleys1, irangeshgtmax1 968 INTEGER, DIMENSION(d2) :: ipeaks2, ivalleys2, irangeshgtmax2 969 REAL(r_k), DIMENSION(d1) :: rangeshgtmax1 970 REAL(r_k), DIMENSION(d2) :: rangeshgtmax2 971 INTEGER, DIMENSION(2,d1) :: ranges1 972 INTEGER, DIMENSION(2,d2) :: ranges2 970 973 971 974 !!!!!!! Variables … … 983 986 ! origfaces: original faces (-1, downhill; 0: valley; 1: uphill) 984 987 ! filtfaces: filtered faces (-1, downhill; 0: valley; 1: uphill) 988 ! rangeshgtmax: maximum height for each individual range [m] 989 ! ptrangeshgtmax: grid point maximum height for each individual range [1] 985 990 986 991 fname = 'compute_range_faces' … … 992 997 DO j=1, d2 993 998 CALL var_range_faces(d1, lon(:,j), lat(:,j), hgt(:,j), Nfilt, newrange, hgtmax1, pthgtmax1, & 994 derivhgt(:,j), Npeaks, ipeaks1, Nvalleys, ivalleys1, origfaces(:,j), filtfaces(:,j)) 999 derivhgt(:,j), Npeaks, ipeaks1, Nvalleys, ivalleys1, origfaces(:,j), filtfaces(:,j), & 1000 Nranges, ranges1, rangeshgtmax1, irangeshgtmax1) 995 1001 hgtmax(:,j) = hgtmax1 996 1002 pthgtmax(pthgtmax1,j) = 1 … … 1001 1007 valleys(ivalleys1(i),j) = 1 1002 1008 END DO 1009 DO i=1, Nranges 1010 rangeshgtmax(ranges1(1,i):ranges1(2,i),j) = rangeshgtmax1(i) 1011 ptrangeshgtmax(irangeshgtmax1(i),j) = 1 1012 END DO 1003 1013 END DO 1004 1014 ELSE IF (TRIM(face) == 'SN') THEN 1005 1015 DO i=1, d1 1006 1016 CALL var_range_faces(d2, lon(i,:), lat(i,:), hgt(i,:), Nfilt, newrange, hgtmax1, pthgtmax1, & 1007 derivhgt(i,:), Npeaks, ipeaks2, Nvalleys, ivalleys2, origfaces(i,:), filtfaces(i,:)) 1017 derivhgt(i,:), Npeaks, ipeaks2, Nvalleys, ivalleys2, origfaces(i,:), filtfaces(i,:), & 1018 Nranges, ranges2, rangeshgtmax2, irangeshgtmax2) 1008 1019 hgtmax(i,:) = hgtmax1 1009 1020 pthgtmax(i,pthgtmax1) = 1 … … 1013 1024 DO j=1, Nvalleys 1014 1025 valleys(i,ivalleys2(j)) = 1 1026 END DO 1027 DO j=1, Nranges 1028 rangeshgtmax(i,ranges2(1,j):ranges2(2,j)) = rangeshgtmax2(j) 1029 ptrangeshgtmax(i,irangeshgtmax2(j)) = 1 1015 1030 END DO 1016 1031 END DO -
trunk/tools/module_ForDiagnosticsVars.f90
r2213 r2214 1581 1581 1582 1582 SUBROUTINE var_range_faces(d, lon, lat, hgt, filt, newrange, hgtmax, ihgtmax, dhgt, Npeaks, ipeaks, & 1583 Nvalleys, ivalleys, faces0, faces )1583 Nvalleys, ivalleys, faces0, faces, Nranges, ranges, rangeshgtmax, irangeshgtmax) 1584 1584 ! Subroutine to compute faces [uphill, valleys, downhill] of a monuntain range along a face 1585 1585 … … 1588 1588 INTEGER, INTENT(in) :: d, filt, newrange 1589 1589 REAL(r_k), DIMENSION(d), INTENT(in) :: lon, lat, hgt 1590 INTEGER, INTENT(out) :: ihgtmax 1590 INTEGER, INTENT(out) :: ihgtmax, Npeaks, Nvalleys, Nranges 1591 INTEGER, DIMENSION(d), INTENT(out) :: ipeaks, ivalleys, faces0, faces, & 1592 irangeshgtmax 1593 INTEGER, DIMENSION(2,d), INTENT(out) :: ranges 1591 1594 REAL(r_k), INTENT(out) :: hgtmax 1592 1595 REAL(r_k), DIMENSION(d), INTENT(out) :: dhgt, rangeshgtmax 1593 INTEGER, DIMENSION(d), INTENT(out) :: ipeaks, ivalleys, faces0, faces, &1594 irangeshgtmax1595 INTEGER, INTENT(out) :: Npeaks, Nvalleys, Nranges1596 1596 1597 1597 ! Local 1598 1598 INTEGER :: i, j, j1, k, l, m 1599 INTEGER :: iface , Nranges1599 INTEGER :: iface 1600 1600 INTEGER :: Nfaces, Nfaces1, Npeaks1, Nvalleys1 1601 1601 INTEGER :: fbeg, fend … … 1604 1604 INTEGER, DIMENSION(d) :: faces1, Ndhgt1, ipeaks1, ivalleys1 1605 1605 REAL(r_k), DIMENSION(d) :: dLl, peaks, valleys, peaks1, valleys1 1606 LOGICAL :: peakwithin, valleywithin 1606 REAL(r_k), DIMENSION(d) :: sortedpeaks 1607 INTEGER, DIMENSION(d) :: isortedpeaks 1608 LOGICAL :: rangewithin, peakwithin, valleywithin 1607 1609 1608 1610 !!!!!!! Variables … … 1682 1684 !PRINT *, Nfaces, ' length faces:', Ndhgt(1:Nfaces) 1683 1685 1684 ! Defining quantitiy of ranges within the face 1686 ! Defining quantitiy of ranges within the face 1687 ! sorting peaks within the face and defining ranges as maximum peaks distanced > newrage 1688 sortedpeaks = peaks 1689 CALL SortR_K(sortedpeaks, Npeaks) 1690 isortedpeaks = 0 1691 DO i=1, Npeaks 1692 DO j=1, Npeaks 1693 IF (peaks(j) == sortedpeaks(i)) isortedpeaks(i) = ipeaks(j) 1694 END DO 1695 END DO 1696 1697 ranges = -1 1685 1698 Nranges = 1 1686 IF (Npeaks > 2) THEN 1687 DO i=1, Npeaks-1 1688 IF (ipeaks(j+1)-ipeaks(j) < newrange)) THEN 1689 AQUI 1699 ranges(1,Nranges) = ipeaks(1) 1700 ranges(2,Nranges) = ipeaks(1) 1701 irangeshgtmax(Nranges) = ipeaks(1) 1702 rangeshgtmax(Nranges) = peaks(1) 1703 IF (Npeaks >= 2) THEN 1704 DO j=2, Npeaks 1705 rangewithin = .FALSE. 1706 IF (ranges(1,Nranges) - isortedpeaks(j) < newrange) THEN 1707 ranges(2,Nranges) = ipeaks(j) 1708 IF (peaks(j) > rangeshgtmax(Nranges)) THEN 1709 rangeshgtmax(Nranges) = peaks(j) 1710 irangeshgtmax(Nranges) = ipeaks(j) 1711 END IF 1712 ELSE 1713 Nranges = Nranges + 1 1714 ranges(1,Nranges) = ipeaks(j) 1715 ranges(2,Nranges) = ipeaks(j) 1716 rangeshgtmax(Nranges) = peaks(j) 1717 irangeshgtmax(Nranges) = ipeaks(j) 1690 1718 END IF 1691 1719 END DO 1692 1720 END IF 1693 1694 ! Defining valleys as that consecutive grid points below surroungind peaks from the same range 1721 !PRINT *, Nranges, ' _______' 1722 !DO i=, Nranges 1723 ! PRINT *,i,':', ranges(:,i),' max:', rangeshgtmax(i), ' ,', irangeshgtmax(i) 1724 !END DO 1725 1726 ! Defining valleys as that consecutive grid points below surrounding peaks from the same range and 1727 ! below range max 1728 k = 1 1695 1729 IF (Npeaks > 1) THEN 1696 1730 j = 1 1697 1731 j1 = 2 1698 1732 DO i=2, d 1699 IF (i >= ipeaks(j) .AND. i < ipeaks(j+1) .AND. (ipeaks(j+1) -ipeaks(j) < newrange)) THEN1733 IF (i >= ipeaks(j) .AND. i < ipeaks(j+1) .AND. (ipeaks(j+1) < ranges(2,k))) THEN 1700 1734 IF (hgt(i) < peaks(j) .AND. hgt(i) < peaks(j+1)) faces0(i) = 0 1701 IF (i == ipeaks(j) .AND. hgt(i) < hgtmax) faces0(i) = 01735 IF (i == ipeaks(j) .AND. hgt(i) < rangeshgtmax(k)) faces0(i) = 0 1702 1736 ELSE IF (i == ipeaks(j+1)) THEN 1703 1737 j = j1 … … 1706 1740 END IF 1707 1741 END DO 1742 IF (ipeaks(j+1) > ranges(2,k)) k = k+1 1708 1743 END IF 1709 1744
Note: See TracChangeset
for help on using the changeset viewer.