1 | !! Diagnostics: U & V on earth coordinates |
---|
2 | |
---|
3 | MODULE module_calc_uvmet |
---|
4 | |
---|
5 | CONTAINS |
---|
6 | SUBROUTINE calc_uvmet(SCR4, cname, cdesc, cunits) |
---|
7 | |
---|
8 | USE constants_module |
---|
9 | USE module_model_basics |
---|
10 | |
---|
11 | !Arguments |
---|
12 | real,allocatable,dimension(:,:,:,:) :: SCR4 |
---|
13 | character (len=128) :: cname, cdesc, cunits |
---|
14 | |
---|
15 | !Local |
---|
16 | integer :: i, j |
---|
17 | real :: cone |
---|
18 | real, dimension(west_east_dim,south_north_dim) :: diff, alpha |
---|
19 | |
---|
20 | |
---|
21 | SCR4 = 0.0 |
---|
22 | |
---|
23 | |
---|
24 | IF ( map_proj .ge. 3 ) THEN ! No need to rotate |
---|
25 | SCR4(:,:,:,1) = UUU |
---|
26 | SCR4(:,:,:,2) = VVV |
---|
27 | END IF |
---|
28 | |
---|
29 | |
---|
30 | cone = 1. ! PS |
---|
31 | IF ( map_proj .eq. 1) THEN ! Lambert Conformal mapping |
---|
32 | IF (ABS(truelat1-truelat2) .GT. 0.1) THEN |
---|
33 | cone=(ALOG(COS(truelat1*RAD_PER_DEG))- & |
---|
34 | ALOG(COS(truelat2*RAD_PER_DEG))) / & |
---|
35 | (ALOG(TAN((90.-ABS(truelat1))*RAD_PER_DEG*0.5 ))- & |
---|
36 | ALOG(TAN((90.-ABS(truelat2))*RAD_PER_DEG*0.5 )) ) |
---|
37 | ELSE |
---|
38 | cone = SIN(ABS(truelat1)*RAD_PER_DEG ) |
---|
39 | ENDIF |
---|
40 | END IF |
---|
41 | |
---|
42 | |
---|
43 | diff = XLONG - stand_lon |
---|
44 | DO i = 1, west_east_dim |
---|
45 | DO j = 1, south_north_dim |
---|
46 | IF ( diff(i,j) .gt. 180. ) THEN |
---|
47 | diff(i,j) = diff(i,j) - 360. |
---|
48 | END IF |
---|
49 | IF ( diff(i,j) .lt. -180. ) THEN |
---|
50 | diff(i,j) = diff(i,j) + 360. |
---|
51 | END IF |
---|
52 | END DO |
---|
53 | END DO |
---|
54 | |
---|
55 | |
---|
56 | DO i = 1, west_east_dim |
---|
57 | DO j = 1, south_north_dim |
---|
58 | IF ( XLAT(i,j) .lt. 0. ) THEN |
---|
59 | alpha(i,j) = - diff(i,j) * cone * RAD_PER_DEG |
---|
60 | ELSE |
---|
61 | alpha(i,j) = diff(i,j) * cone * RAD_PER_DEG |
---|
62 | END IF |
---|
63 | END DO |
---|
64 | END DO |
---|
65 | |
---|
66 | |
---|
67 | DO k = 1,bottom_top_dim |
---|
68 | SCR4(:,:,k,1) = VVV(:,:,k)*sin(alpha) + UUU(:,:,k)*cos(alpha) |
---|
69 | SCR4(:,:,k,2) = VVV(:,:,k)*cos(alpha) - UUU(:,:,k)*sin(alpha) |
---|
70 | END DO |
---|
71 | |
---|
72 | |
---|
73 | cname = "uvmet" |
---|
74 | cdesc = "Rotated wind component" |
---|
75 | cunits = "m s-1" |
---|
76 | |
---|
77 | END SUBROUTINE calc_uvmet |
---|
78 | |
---|
79 | END MODULE module_calc_uvmet |
---|