9 integer :: n, i, j, nx, ny
10 integer :: istatus, start_mem_i, end_mem_i, start_mem_j, end_mem_j, &
11 start_mem_k, end_mem_k, dyn_opt, &
12 west_east_dim, south_north_dim, bottom_top_dim, map_proj, is_water, num_land_cat, &
13 is_ice, is_urban, isoilwater, grid_id, parent_id, i_parent_start, j_parent_start, &
14 i_parent_end, j_parent_end, parent_grid_ratio, &
15 we_patch_s, we_patch_e, we_patch_s_stag, we_patch_e_stag, &
16 sn_patch_s, sn_patch_e, sn_patch_s_stag, sn_patch_e_stag
18 real :: dx, dy, cen_lat, moad_cen_lat, cen_lon, stand_lon, truelat1, truelat2, pole_lat, pole_lon
19 real :: start_r, start_g, start_b, end_r, end_g, end_b
20 real :: ll_lat, ll_lon, ur_lat, ur_lon
21 real :: left, right, bottom, top, maxter, minter
23 real, dimension(16) :: corner_lats, corner_lons
24 real, dimension(10000) :: xcs, ycs
25 integer, dimension(10) :: iai, iag
26 integer, dimension(400000) :: iam
27 integer, allocatable, dimension(:,:) :: lu
28 real, allocatable, dimension(:,:) :: xlat, xlon, ter
29 real, dimension(122000) :: rwrk
30 real, pointer, dimension(:,:,:) :: real_array
31 character (len=3) :: memorder
32 character (len=25) :: crotang
33 character (len=25) :: units
34 character (len=46) :: desc
35 character (len=128) :: init_date, cname, stagger, cunits, cdesc, title, startdate, grid_type, mminlu
36 character (len=128), dimension(3) :: dimnames
38 call getarg(1,crotang)
39 read (crotang,'(f)') rotang
41 write(6,*) 'Plotting with rotation angle ',rotang
47 call gscr(1, 0, 1.00, 1.00, 1.00)
48 call gscr(1, 1, 0.00, 0.00, 0.00)
49 call gscr(1, 2, 0.25, 0.25, 0.25)
50 call gscr(1, 3, 1.00, 1.00, 0.50)
51 call gscr(1, 4, 0.50, 1.00, 0.50)
52 call gscr(1, 5, 1.00, 1.00, 0.00)
53 call gscr(1, 6, 1.00, 1.00, 0.00)
54 call gscr(1, 7, 0.50, 1.00, 0.50)
55 call gscr(1, 8, 1.00, 1.00, 0.50)
56 call gscr(1, 9, 0.50, 1.00, 0.50)
57 call gscr(1,10, 0.50, 1.00, 0.50)
58 call gscr(1,11, 1.00, 1.00, 0.50)
59 call gscr(1,12, 0.00, 1.00, 0.00)
60 call gscr(1,13, 0.00, 0.50, 0.00)
61 call gscr(1,14, 0.00, 1.00, 0.00)
62 call gscr(1,15, 0.00, 0.50, 0.00)
63 call gscr(1,16, 0.00, 1.00, 0.00)
64 call gscr(1,17, 0.50, 0.50, 1.00)
65 call gscr(1,18, 0.00, 1.00, 0.00)
66 call gscr(1,19, 0.00, 1.00, 0.00)
67 call gscr(1,20, 0.75, 0.75, 0.75)
68 call gscr(1,21, 0.75, 0.75, 0.75)
69 call gscr(1,22, 0.00, 0.50, 0.00)
70 call gscr(1,23, 0.75, 0.75, 0.75)
71 call gscr(1,24, 0.75, 0.75, 0.75)
72 call gscr(1,25, 1.00, 1.00, 1.00)
81 call gscr(1,i,start_r+((end_r-start_r)/50.)*real(i-26),start_g+((end_g-start_g)/50.)*real(i-26),start_b+((end_b-start_b)/50.)*real(i-26))
91 call gscr(1,i,start_r+((end_r-start_r)/50.)*real(i-77),start_g+((end_g-start_g)/50.)*real(i-77),start_b+((end_b-start_b)/50.)*real(i-77))
101 call gscr(1,i,start_r+((end_r-start_r)/50.)*real(i-127),start_g+((end_g-start_g)/50.)*real(i-127),start_b+((end_b-start_b)/50.)*real(i-127))
104 call get_namelist_params()
107 call input_init(n, istatus)
108 if (istatus /= 0) then
110 write(6,*) 'Error: Could not open domain01 file.'
115 call read_global_attrs(title, init_date, grid_type, dyn_opt, &
116 west_east_dim, south_north_dim, bottom_top_dim, &
117 we_patch_s, we_patch_e, we_patch_s_stag, we_patch_e_stag, &
118 sn_patch_s, sn_patch_e, sn_patch_s_stag, sn_patch_e_stag, &
119 map_proj, mminlu, num_land_cat, is_water, &
120 is_ice, is_urban, isoilwater, grid_id, parent_id, i_parent_start, j_parent_start, &
121 i_parent_end, j_parent_end, dx, dy, cen_lat, moad_cen_lat, cen_lon, &
122 stand_lon, truelat1, truelat2, pole_lat, pole_lon, parent_grid_ratio, &
123 corner_lats, corner_lons)
126 do while (istatus == 0)
127 call read_next_field(start_mem_i, end_mem_i, start_mem_j, end_mem_j, &
128 start_mem_k, end_mem_k, cname, cunits, cdesc, &
129 memorder, stagger, dimnames, real_array, istatus)
130 if (istatus == 0) then
132 if (index(cname, 'XLAT_M') /= 0) then
133 nx = end_mem_i - start_mem_i + 1
134 ny = end_mem_j - start_mem_j + 1
135 allocate(xlat(nx,ny))
136 xlat = real_array(:,:,1)
137 else if (index(cname, 'XLONG_M') /= 0) then
138 nx = end_mem_i - start_mem_i + 1
139 ny = end_mem_j - start_mem_j + 1
140 allocate(xlon(nx,ny))
141 xlon = real_array(:,:,1)
142 else if (index(cname, 'LU_INDEX') /= 0) then
143 nx = end_mem_i - start_mem_i + 1
144 ny = end_mem_j - start_mem_j + 1
146 lu = nint(real_array(:,:,1))
157 ! if (ur_lon < 0.) ur_lon = ur_lon + 360.0
164 call mappos(left,right,bottom,top)
166 call mapstc('OU','CO')
168 call maproj('CE', cen_lat, cen_lon, rotang)
169 ! call maproj('LC', truelat1, stand_lon, truelat2)
170 ! call maproj('ST', cen_lat, cen_lon, stand_lon)
171 call mapset('CO', ll_lat, ll_lon, ur_lat, ur_lon)
175 call mpsetr('GR', 10.0)
177 call maptrn(ll_lat, ll_lon, left, bottom)
178 call maptrn(ur_lat, ur_lon, right, top)
180 width = 1.02*(right-left)/real(nx)
181 height = 1.02*(top-bottom)/real(ny)
185 call map_square(xlat(i,j), xlon(i,j), width, height, lu(i,j)+1)
191 call lined(left-width/2.,bottom-height/2.,left-width/2.,top+height/2.)
192 call lined(left-width/2.,top+height/2.,right+width/2.,top+height/2.)
193 call lined(right+width/2.,top+height/2.,right+width/2.,bottom-height/2.)
194 call lined(right+width/2.,bottom-height/2.,left-width/2.,bottom-height/2.)
204 call mplndr('Earth..3',4)
206 call arinam (iam,400000)
208 call arpram (iam,0,0,0)
210 call mapgrm (iam,xcs,ycs,10000,iai,iag,10,ulpr)
215 call input_init(n, istatus)
216 if (istatus /= 0) then
218 write(6,*) 'Error: Could not open domain01 file.'
223 call read_global_attrs(title, init_date, grid_type, dyn_opt, &
224 west_east_dim, south_north_dim, bottom_top_dim, &
225 we_patch_s, we_patch_e, we_patch_s_stag, we_patch_e_stag, &
226 sn_patch_s, sn_patch_e, sn_patch_s_stag, sn_patch_e_stag, &
227 map_proj, mminlu, num_land_cat, is_water, &
228 is_ice, is_urban, isoilwater, grid_id, parent_id, i_parent_start, j_parent_start, &
229 i_parent_end, j_parent_end, dx, dy, cen_lat, moad_cen_lat, cen_lon, &
230 stand_lon, truelat1, truelat2, pole_lat, pole_lon, parent_grid_ratio, &
231 corner_lats, corner_lons)
234 do while (istatus == 0)
235 call read_next_field(start_mem_i, end_mem_i, start_mem_j, end_mem_j, &
236 start_mem_k, end_mem_k, cname, cunits, cdesc, &
237 memorder, stagger, dimnames, real_array, istatus)
238 if (istatus == 0) then
240 if (index(cname, 'XLAT_M') /= 0) then
241 nx = end_mem_i - start_mem_i + 1
242 ny = end_mem_j - start_mem_j + 1
243 allocate(xlat(nx,ny))
244 xlat = real_array(:,:,1)
245 else if (index(cname, 'XLONG_M') /= 0) then
246 nx = end_mem_i - start_mem_i + 1
247 ny = end_mem_j - start_mem_j + 1
248 allocate(xlon(nx,ny))
249 xlon = real_array(:,:,1)
250 else if (index(cname, 'HGT_M') /= 0) then
251 nx = end_mem_i - start_mem_i + 1
252 ny = end_mem_j - start_mem_j + 1
254 ter = real_array(:,:,1)
255 else if (index(cname, 'LU_INDEX') /= 0) then
256 nx = end_mem_i - start_mem_i + 1
257 ny = end_mem_j - start_mem_j + 1
259 lu = nint(real_array(:,:,1))
276 call mappos(left,right,bottom,top)
278 call mapstc('OU','CO')
280 call maproj('CE', cen_lat, cen_lon, rotang)
281 ! call maproj('LC', truelat1, stand_lon, truelat2)
282 ! call maproj('ST', cen_lat, cen_lon, stand_lon)
283 call mapset('CO', ll_lat, ll_lon, ur_lat, ur_lon)
290 if (ter(i,j) > maxter) maxter = ter(i,j)
291 if (ter(i,j) < minter) minter = ter(i,j)
297 call maptrn(ll_lat, ll_lon, left, bottom)
298 call maptrn(ur_lat, ur_lon, right, top)
300 width = 1.02*(right-left)/real(nx)
301 height = 1.02*(top-bottom)/real(ny)
305 if (lu(i,j) == 16) then
306 ter(i,j) = ((ter(i,j)-minter) * 99.)/(maxter-minter) + 26.
307 call map_square(xlat(i,j), xlon(i,j), width, height, 17)
308 else if (lu(i,j) == 1) then
309 ter(i,j) = ((ter(i,j)-minter) * 99.)/(maxter-minter) + 26.
310 call map_square(xlat(i,j), xlon(i,j), width, height, 2)
311 else if (lu(i,j) == 24) then
312 ter(i,j) = ((ter(i,j)-minter) * 50.)/(3500.0-minter) + 127.
313 call map_square(xlat(i,j), xlon(i,j), width, height, nint(ter(i,j)))
315 ter(i,j) = ((ter(i,j)-minter) * 99.)/(maxter-minter) + 26.
316 call map_square(xlat(i,j), xlon(i,j), width, height, nint(ter(i,j)))
323 call lined(left-width/2.,bottom-height/2.,left-width/2.,top+height/2.)
324 call lined(left-width/2.,top+height/2.,right+width/2.,top+height/2.)
325 call lined(right+width/2.,top+height/2.,right+width/2.,bottom-height/2.)
326 call lined(right+width/2.,bottom-height/2.,left-width/2.,bottom-height/2.)
337 call mplndr('Earth..3',4)
339 call arinam (iam,400000)
341 call arpram (iam,0,0,0)
343 call mapgrm (iam,xcs,ycs,10000,iai,iag,10,ulpr)
355 subroutine map_square(rlat, rlon, width, height, colr)
360 real :: rlat, rlon, width, height
365 real, dimension(4) :: xra, yra
366 real, dimension(2000) :: dst
367 integer, dimension(3000) :: ind
369 call maptrn(rlat, rlon, u, v)
371 xra(1) = u-(width/2.)
372 xra(2) = u+(width/2.)
373 xra(3) = u+(width/2.)
374 xra(4) = u-(width/2.)
376 yra(1) = v-(height/2.)
377 yra(2) = v-(height/2.)
378 yra(3) = v+(height/2.)
379 yra(4) = v+(height/2.)
381 call sfsgfa(xra, yra, 4, dst, 2000, ind, 3000, colr)
383 end subroutine map_square
386 subroutine ulpr(xcs,ycs,ncs,iai,iag,nai)
390 integer, external :: mapaci
393 integer, dimension(nai) :: iai, iag
394 real, dimension(ncs) :: xcs, ycs
398 if (iai(1) >= 0 .and.iai(2) >= 0) then
399 itm = max0(iai(1),iai(2))
400 if (mapaci(itm) == 1) then
401 if (ncs.gt.150) print * , 'ulpr - ncs too big - ',ncs
402 call gpl(ncs,xcs,ycs)