34 private :: readler5, readler2
44 real,
dimension(:,:),
allocatable :: brdf650
45 character(len=255),
dimension(:),
allocatable :: aero_sites
46 integer,
dimension(:),
allocatable :: aero_zones
47 integer,
dimension(:),
allocatable :: aero_types
48 integer,
dimension(:),
allocatable :: aero_elev
49 real,
dimension(:,:),
allocatable :: aero_sr412, aero_sr470, aero_sr650, aero_bgaod
53 real,
dimension(360,180) :: bg_aod
55 integer :: lerstart(2), leredge(2), dateline
56 integer :: lerstart6(2), leredge6(2), dateline6
57 real,
dimension(:,:,:,:),
allocatable :: coefs650_fwd, coefs470_fwd, coefs412_fwd
58 real,
dimension(:,:,:,:),
allocatable :: coefs650_all, coefs470_all, coefs412_all
60 real,
dimension(:,:),
allocatable :: gref412_all, gref412_fwd
61 real,
dimension(:,:),
allocatable :: gref470_all, gref470_fwd
62 real,
dimension(:,:),
allocatable :: gref650_all, gref650_fwd
63 real,
dimension(:,:),
allocatable :: gref865_all
66 real,
dimension(:,:),
allocatable :: vgref412_all
67 real,
dimension(:,:),
allocatable :: vgref488_all
68 real,
dimension(:,:),
allocatable :: vgref670_all
71 real,
dimension(:,:,:),
allocatable :: swir_coeffs412, swir_coeffs470
72 real,
dimension(:,:),
allocatable :: swir_stderr412, swir_stderr470
73 real,
dimension(:,:),
allocatable :: swir_min, swir_max
75 real,
parameter :: ndvi1_cutoff = 0.18
76 real,
parameter :: ndvi2_cutoff = 0.35
89 character(len=255),
intent(in) :: tflg_file
90 integer,
intent(in) :: season
92 real,
dimension(:,:),
allocatable :: tmptfn
93 real,
dimension(:,:,:),
allocatable :: tmpaod
97 character(len=255) :: sds_name
98 character(len=255) :: dset_name
99 character(len=255) :: attr_name
100 character(len=255) :: group_name
106 integer :: sd_id, sds_index, sds_id
107 integer,
dimension(2) :: start2, stride2, edges2
108 integer,
dimension(3) :: start3, stride3, edges3
113 allocate(tmptfn(3600,1800), stat=status)
114 if (status /= 0)
then
115 print *,
"ERROR: Unable to allocate tmp array for geo zone data: ", status
120 allocate(tmpaod(360,180,4), stat=status)
121 if (status /= 0)
then
122 print *,
"ERROR: Unable to allocate tmp array for background aod data: ", status
126 status = nf90_open(tflg_file, nf90_nowrite, nc_id)
127 if (status /= nf90_noerr)
then
128 print *,
"ERROR: Failed to open deepblue lut_nc4 file: ", status
132 group_name =
'GEOZONE'
133 status = nf90_inq_ncid(nc_id, group_name, grp_id)
134 if (status /= nf90_noerr)
then
135 print *,
"ERROR: Failed to get ID of group "//
trim(group_name)//
": ", status
141 edges2 = (/3600,1800/)
142 dset_name =
'GEOZONE_FLAG'
143 status = nf90_inq_varid(grp_id, dset_name, dset_id)
144 if (status /= nf90_noerr)
then
145 print *,
"ERROR: Failed to get ID of dataset "//
trim(dset_name)//
": ", status
148 status = nf90_get_var(grp_id, dset_id, tmptfn, start=start2, &
149 stride=stride2, count=edges2)
150 if (status /= nf90_noerr)
then
151 print *,
"ERROR: Failed to read dataset "//
trim(dset_name)//
": ", status
155 dset_name =
'ELEVATION_STDV'
156 status = nf90_inq_varid(grp_id, dset_name, dset_id)
157 if (status /= nf90_noerr)
then
158 print *,
"ERROR: Failed to get ID of dataset "//
trim(dset_name)//
": ", status
161 status = nf90_get_var(grp_id, dset_id,
sfc_elev_std, start=start2, &
162 stride=stride2, count=edges2)
163 if (status /= nf90_noerr)
then
164 print *,
"ERROR: Failed to read dataset "//
trim(dset_name)//
": ", status
170 edges3 = (/360,180,4/)
171 dset_name =
'BACKGROUND_AOD'
172 status = nf90_inq_varid(grp_id, dset_name, dset_id)
173 if (status /= nf90_noerr)
then
174 print *,
"ERROR: Failed to get ID of dataset "//
trim(dset_name)//
": ", status
177 status = nf90_get_var(grp_id, dset_id, tmpaod, start=start3, &
178 stride=stride3, count=edges3)
179 if (status /= nf90_noerr)
then
180 print *,
"ERROR: Failed to read dataset "//
trim(dset_name)//
": ", status
184 status = nf90_close(nc_id)
185 if (status /= nf90_noerr)
then
186 print *,
"ERROR: Failed to close lut_nc4 file: ", status
191 bg_aod(1:360,1:180) = tmpaod(1:360,1:180,season)
195 deallocate(tmptfn, stat=status)
196 if (status /= 0)
then
197 print *,
"ERROR: Unable to deallocate tmp array for geo zone data: ", status
202 deallocate(tmpaod, stat=status)
203 if (status /= 0)
then
204 print *,
"ERROR: Unable to deallocate tmp array for geo zone data: ", status
220 character(len=255),
intent(in) :: file
222 real,
dimension(:,:),
allocatable :: tmptfn
226 character(len=255) :: sds_name
227 character(len=255) :: dset_name
228 character(len=255) :: attr_name
229 character(len=255) :: group_name
235 integer :: sd_id, sds_index, sds_id
236 integer,
dimension(2) :: start2, stride2, edges2
240 status = nf90_open(file, nf90_nowrite, nc_id)
241 if (status /= nf90_noerr)
then
242 print *,
"ERROR: Failed to open deepblue lut_nc4 file: ", status
246 group_name =
'LANDCOVER'
247 status = nf90_inq_ncid(nc_id, group_name, grp_id)
248 if (status /= nf90_noerr)
then
249 print *,
"ERROR: Failed to get ID of group "//
trim(group_name)//
": ", status
255 edges2 = (/3600,1800/)
256 dset_name =
'DESERTS_FLAG'
257 status = nf90_inq_varid(grp_id, dset_name, dset_id)
258 if (status /= nf90_noerr)
then
259 print *,
"ERROR: Failed to get ID of dataset "//
trim(dset_name)//
": ", status
262 status = nf90_get_var(grp_id, dset_id,
terrain_flag, start=start2, &
263 stride=stride2, count=edges2)
264 if (status /= nf90_noerr)
then
265 print *,
"ERROR: Failed to read dataset "//
trim(dset_name)//
": ", status
269 status = nf90_close(nc_id)
270 if (status /= nf90_noerr)
then
271 print *,
"ERROR: Failed to close lut_nc4 file: ", status
282 integer function load_brdf(brdffile)
result(status)
290 character(len=255),
intent(in) :: brdffile
292 integer,
parameter :: nsites = 30
294 character(len=255) :: sds_name
295 character(len=255) :: dset_name
296 character(len=255) :: attr_name
297 character(len=255) :: group_name
303 integer :: sd_id, sds_index, sds_id
304 integer,
dimension(2) :: start2, stride2, edges2, dims2
310 allocate(aero_sites(nsites), aero_zones(nsites), aero_types(nsites), aero_elev(nsites), &
312 if (status /= 0)
then
313 print *,
"ERROR: Unable to allocate AERONET site info arrays: ", status
317 allocate(aero_sr412(nsites,4), aero_sr470(nsites,4), aero_sr650(nsites,4), aero_bgaod(nsites,4), stat=status)
318 if (status /= 0)
then
319 print *,
"ERROR: Unable to allocate AERONET SR arrays: ", status
333 aero_sites(1) =
'Banizoumbou'
337 aero_sr412(1,:) = (/7.08923, 7.71880, 8.48224, 6.62584/)
338 aero_sr470(1,:) = (/10.5942, 11.6695, 12.4470, 9.9028/)
339 aero_sr650(1,:) = (/28.7862, 31.9045, 31.5499, 25.0119/)
340 aero_bgaod(1,:) = (/0.15000, 0.22800, 0.26300, 0.18500/)
344 aero_sites(2) =
'Tinga_Tingana'
348 aero_sr412(2,:) = (/8.3397, 9.3348, 8.3018, 10.4549/)
349 aero_sr470(2,:) = (/11.5649, 12.8902, 11.5255, 13.5749/)
350 aero_sr650(2,:) = (/29.0277, 31.3340, 27.9479, 30.2249/)
351 aero_bgaod(2,:) = (/0.02300, 0.01900, 0.01800, 0.02100/)
355 aero_sites(3) =
'Zinder_Airport'
359 aero_sr412(3,:) = (/7.59892, 8.63954, 8.38775, 6.58359/)
360 aero_sr470(3,:) = (/11.3537, 12.8399, 12.3052, 9.87239/)
361 aero_sr650(3,:) = (/26.7511, 30.1220, 27.5969, 21.1145/)
362 aero_bgaod(3,:) = (/0.15400, 0.29600, 0.30200, 0.14300/)
366 aero_sites(4) =
'Moldova'
370 aero_sr412(4,:) = (/-999.000, 6.10670, 5.23876, 5.76111/)
371 aero_sr470(4,:) = (/-999.000, 7.08618, 6.13133, 6.63834/)
372 aero_sr650(4,:) = (/-999.000, 8.11562, 7.51764, 7.96273/)
373 aero_bgaod(4,:) = (/0.01900, 0.05900, 0.07700, 0.04300/)
377 aero_sites(5) =
'Beijing'
381 aero_sr412(5,:) = (/5.04678, 6.91650, 6.04189, 5.75009/)
382 aero_sr470(5,:) = (/7.59624, 8.45864, 7.31190, 7.05383/)
383 aero_sr650(5,:) = (/11.7573, 11.3573, 9.2663, 8.54484/)
384 aero_bgaod(5,:) = (/0.13800, 0.18100, 0.14400, 0.11400/)
388 aero_sites(6) =
'Kanpur'
393 aero_sr412(6,:) = (/8.76996,6.24308,8.49987,7.49987/)
394 aero_sr470(6,:) = (/6.26996,5.74308,7.99987,5.99987/)
395 aero_sr650(6,:) = (/10.25542,10.1785,11.75790,10.75790/)
396 aero_bgaod(6,:) = (/0.27400, 0.24800, 0.27600, 0.27900/)
400 aero_sites(7) =
'Modena'
404 aero_sr412(7,:) = (/3.7846,5.30996,5.72852,5.69932/)
405 aero_sr470(7,:) = (/5.3279,6.31288,7.11941,6.54509/)
406 aero_sr650(7,:) = (/5.5748,9.44464,9.73280,10.1099/)
407 aero_bgaod(7,:) = (/0.02100, 0.09200, 0.09900, 0.03900/)
411 aero_sites(8) =
'Palencia'
415 aero_sr412(8,:) = (/-999.000,5.03951,4.76740,-999.000/)
416 aero_sr470(8,:) = (/-999.000,6.17346,6.62762,-999.000/)
417 aero_sr650(8,:) = (/-999.000,8.70520,10.7275,-999.000/)
418 aero_bgaod(8,:) = (/0.02500, 0.04000, 0.02700, 0.03300/)
422 aero_sites(9) =
'Lecce_University'
426 aero_sr412(9,:) = (/4.68698,4.01772,6.14852,5.86577/)
427 aero_sr470(9,:) = (/5.16447,5.68885,8.15023,6.82434/)
428 aero_sr650(9,:) = (/10.1211,10.6153,11.0301,11.3503/)
429 aero_bgaod(9,:) = (/0.05700, 0.08800, 0.06200, 0.06800/)
437 aero_sites(10) =
'Fresno_2'
441 aero_sr412(10,:) = (/5.68700,4.64569,4.42003,4.78884/)
442 aero_sr470(10,:) = (/6.91660,6.96638,6.80781,6.73356/)
443 aero_sr650(10,:) = (/11.5361,12.2151,12.2892,12.6795/)
444 aero_bgaod(10,:) = (/0.05300, 0.11500, 0.08500, 0.08100/)
448 aero_sites(11) =
'Fresno_GZ18'
452 aero_sr412(11,:) = (/6.18700,5.14569,4.92003,5.28884/)
453 aero_sr470(11,:) = (/7.41660,7.46638,7.30781,7.23356/)
454 aero_sr650(11,:) = (/11.5361,12.2151,12.2892,12.6795/)
455 aero_bgaod(11,:) = (/0.05300, 0.11500, 0.08500, 0.08100/)
459 aero_sites(12) =
'IER_Cinzana'
463 aero_sr412(12,:) = (/5.33969,6.89590,7.78313,5.45146/)
464 aero_sr470(12,:) = (/8.17876,10.2201,11.0532,7.67885/)
465 aero_sr650(12,:) = (/18.6043,21.9242,19.8147,13.6748/)
466 aero_bgaod(12,:) = (/0.16800, 0.24200, 0.12900, 0.17400/)
470 aero_sites(13) =
'Agoufou'
474 aero_sr412(13,:) = (/6.33764,7.20075,7.12166,5.88014/)
475 aero_sr470(13,:) = (/10.3036,11.2734,10.7413,9.34117/)
476 aero_sr650(13,:) = (/26.6428,30.4116,27.0584,21.6639/)
477 aero_bgaod(13,:) = (/0.11800, 0.20500, 0.19900, 0.13200/)
481 aero_sites(14) =
'Saada'
485 aero_sr412(14,:) = (/7.30339, 5.90723, 6.37791, 6.20939/)
486 aero_sr470(14,:) = (/8.68933, 7.76850, 8.46196, 8.15088/)
487 aero_sr650(14,:) = (/14.1430, 14.5881, 16.7061, 15.5649/)
488 aero_bgaod(14,:) = (/0.08300, 0.06400, 0.08800, 0.08700/)
492 aero_sites(15) =
'Trelew'
496 aero_sr412(15,:) = (/5.29937, 5.30638, 6.01197, 5.75946/)
497 aero_sr470(15,:) = (/8.20220, 7.37385, 7.43250, 7.71553/)
498 aero_sr650(15,:) = (/14.0610, 11.7312, 11.2763, 12.9785/)
499 aero_bgaod(15,:) = (/0.02200, 0.01900, 0.01700, 0.01900/)
503 aero_sites(16) =
'Carpentras'
507 aero_sr412(16,:) = (/-999.000,4.27180,3.84850,3.60839/)
508 aero_sr470(16,:) = (/-999.000,5.77824,5.63915,5.02537/)
509 aero_sr650(16,:) = (/-999.000,9.71739,9.57229,8.67115/)
510 aero_bgaod(16,:) = (/0.01900, 0.03200, 0.03500, 0.02100/)
519 aero_sites(17) =
'Pune'
523 aero_sr412(17,:) = (/4.49376,6.22264,4.81305,7.31305/)
524 aero_sr470(17,:) = (/5.42197,8.08891,5.49410,7.99410/)
525 aero_sr650(17,:) = (/8.40501,11.6605,6.73313,9.23313/)
526 aero_bgaod(17,:) = (/0.20400, 0.16400, 0.07500, 0.17100/)
530 aero_sites(18) =
'Evora'
534 aero_sr412(18,:) = (/4.95347,4.48004,4.75238,5.64016/)
535 aero_sr470(18,:) = (/5.60902,5.80674,7.54495,7.83002/)
536 aero_sr650(18,:) = (/6.80235,6.94325,13.3975,11.9871/)
537 aero_bgaod(18,:) = (/0.01900, 0.03400, 0.02600, 0.02500/)
541 aero_sites(19) =
'Blida'
545 aero_sr412(19,:) = (/-999.000,5.20722,5.84409,-999.000/)
546 aero_sr470(19,:) = (/-999.000,7.35584,7.89343,-999.000/)
547 aero_sr650(19,:) = (/-999.000,11.1594,13.5330,-999.000/)
548 aero_bgaod(19,:) = (/0.04400, 0.04900, 0.07700, 0.05800/)
552 aero_sites(20) =
'Blida_High'
556 aero_sr412(20,:) = (/-999.000,5.20722,5.84409,-999.000/)
557 aero_sr470(20,:) = (/-999.000,7.35584,7.89343,-999.000/)
558 aero_sr650(20,:) = (/-999.000,11.1594,13.5330,-999.000/)
559 aero_bgaod(20,:) = (/0.04400, 0.04900, 0.07700, 0.05800/)
563 aero_sites(21) =
'GZ24_Only'
567 aero_sr412(21,:) = (/-999.0,-999.0,-999.0,-999.0/)
568 aero_sr470(21,:) = (/-999.0,-999.0,-999.0,-999.0/)
569 aero_sr650(21,:) = (/-999.0,-999.0,-999.0,-999.0/)
570 aero_bgaod(21,:) = (/ -999.0, -999.0, -999.0, -999.0/)
574 aero_sites(22) =
'Ilorin'
578 aero_sr412(22,:) = (/4.79848, 4.13429, -999.000, -999.000/)
579 aero_sr470(22,:) = (/5.73108, 5.07124, -999.000, -999.000/)
580 aero_sr650(22,:) = (/10.0571, 9.28994, -999.000, -999.000/)
581 aero_bgaod(22,:) = (/0.34500, 0.29700, 0.17300, 0.16400/)
585 aero_sites(23) =
'CCNY'
589 aero_sr412(23,:) = (/5.7380,6.3655,8.7437,5.3349/)
590 aero_sr470(23,:) = (/7.0723,7.5391,8.8168,6.8278/)
591 aero_sr650(23,:) = (/10.1025,10.7149,10.1311,10.5906/)
592 aero_bgaod(23,:) = (/0.04800, 0.06600, 0.13500, 0.06100/)
596 aero_sites(24) =
'Ilorin_Transition'
601 aero_sr412(24,:) = (/4.79848, 4.13429, -999.000, -999.000/)
602 aero_sr470(24,:) = (/5.73108, 5.07124, -999.000, -999.000/)
603 aero_sr650(24,:) = (/10.0571, 9.28994, -999.000, -999.000/)
604 aero_bgaod(24,:) = (/0.34500, 0.29700, 0.17300, 0.16400/)
608 aero_sites(25) =
'SACOL'
612 aero_sr412(25,:) = (/6.57751, 5.85782, 4.26251, 5.79214/)
613 aero_sr470(25,:) = (/8.5020, 8.2185, 5.56137, 6.24013/)
614 aero_sr650(25,:) = (/16.6909, 16.8518, 11.5214, 12.5133/)
615 aero_bgaod(25,:) = (/0.03700, 0.05400, 0.05700, 0.03400/)
619 aero_sites(26) =
'Mexico_City'
622 aero_elev(26) = 2268.0
623 aero_sr412(26,:) = (/6.73461, 6.20030, -999.000, 8.10955 /)
624 aero_sr470(26,:) = (/7.50571, 7.88785, -999.000, 9.46562/)
625 aero_sr650(26,:) = (/7.7320, 10.2994, -999.000, 11.9709/)
626 aero_bgaod(26,:) = (/0.01900, 0.02100, 0.03900, 0.02600/)
630 aero_sites(27) =
'Solar_Village'
633 aero_elev(27) = 764.0
634 aero_sr412(27,:) = (/10.4297, 10.8623, 10.7472, 11.9705/)
635 aero_sr470(27,:) = (/15.0892, 16.1351, 16.0690, 17.0390/)
636 aero_sr650(27,:) = (/32.0747, 34.5677, 35.3692, 34.6681/)
637 aero_bgaod(27,:) = (/0.10100, 0.09800, 0.16700, 0.10900/)
641 aero_sites(28) =
'Jaipur'
644 aero_elev(28) = 450.0
645 aero_sr412(28,:) = (/6.46991, 7.40196, 7.28651, 5.22799/)
646 aero_sr470(28,:) = (/8.49850, 9.42026, 9.49201, 7.03474/)
647 aero_sr650(28,:) = (/11.3653, 12.0653, 15.2039, 10.3618/)
648 aero_bgaod(28,:) = (/0.07100, 0.10500, 0.09500, 0.07100/)
652 aero_sites(29) =
'NW_India_Desert'
655 aero_elev(29) = 450.0
656 aero_sr412(29,:) = (/7.09280, 5.90470, 6.97091, 4.24017/)
657 aero_sr470(29,:) = (/8.31369, 7.69160, 8.73495, 5.41526/)
658 aero_sr650(29,:) = (/11.8653, 13.1653, 15.0039, 10.9618/)
659 aero_bgaod(29,:) = (/0.07100, 0.10500, 0.09500, 0.07100/)
663 aero_sites(30) =
'Yuma'
667 aero_sr412(30,:) = (/6.7668, 6.9406, 8.3705, 7.4484/)
668 aero_sr470(30,:) = (/9.8905, 9.9898, 10.8432, 10.9740/)
669 aero_sr650(30,:) = (/24.7466, 24.4755, 25.5649, 25.4377/)
670 aero_bgaod(30,:) = (/0.07100, 0.12300, 0.11500, 0.08600/)
674 allocate(brdf650(3600,1800), stat=status)
675 if (status /= 0)
then
676 print *,
"ERROR: Unable to allocate array for BRDF base data: ", status
680 status = nf90_open(brdffile, nf90_nowrite, nc_id)
681 if (status /= nf90_noerr)
then
682 print *,
"ERROR: Failed to open deepblue lut_nc4 file: ", status
686 group_name =
'VIIRS_SURFACE_REFLECTANCE'
687 status = nf90_inq_ncid(nc_id, group_name, grp_id)
688 if (status /= nf90_noerr)
then
689 print *,
"ERROR: Failed to get ID of group "//
trim(group_name)//
": ", status
693 dset_name =
'BRDF_650'
694 status = nf90_inq_varid(grp_id, dset_name, dset_id)
695 if (status /= nf90_noerr)
then
696 print *,
"ERROR: Failed to get ID of dataset "//
trim(dset_name)//
": ", status
702 edges2 = (/3600,1800/)
703 status = nf90_get_var(grp_id, dset_id, brdf650, start=start2, &
704 stride=stride2, count=edges2)
705 if (status /= nf90_noerr)
then
706 print *,
"ERROR: Failed to read dataset "//
trim(dset_name)//
": ", status
710 status = nf90_close(nc_id)
711 if (status /= nf90_noerr)
then
712 print *,
"ERROR: Failed to close lut_nc4 file: ", status
723 integer,
intent(inout) :: status
725 deallocate(brdf650, aero_sites, aero_types, aero_zones, stat=status)
726 if (status /= 0)
then
727 print *,
"ERROR: Unable to deallocate BRDF data: ", status
731 deallocate(aero_sr412, aero_sr470, aero_sr650, aero_bgaod, stat=status)
732 if (status /= 0)
then
733 print *,
"ERROR: Unable to deallocate AERONET SR arrays: ", status
747 integer function get_brdfcorr_sr(lat, lon, ra, sa, vza, amf, elev, month, ndvi, stdv, gzone, lc_type, bgaod, &
748 & sr412, sr470, sr650, use_alternate_brdf, debug)
result(status)
752 character(len=50),
parameter :: func_name =
"get_brdfcorr_sr"
754 real,
intent(in) :: lat
755 real,
intent(in) :: lon
756 real,
intent(in) :: ra
757 real,
intent(in) :: sa
758 real,
intent(in) :: vza
759 real,
intent(in) :: amf
760 real,
intent(in) :: elev
761 integer,
intent(in) :: month
762 real,
intent(in) :: ndvi
763 real,
intent(in) :: stdv
764 integer,
intent(in) :: gzone
765 integer,
intent(in) :: lc_type
766 real,
intent(in) :: bgaod
767 real,
intent(inout) :: sr412
768 real,
intent(inout) :: sr470
769 real,
intent(inout) :: sr650
770 logical,
intent(in),
optional :: use_alternate_brdf
771 logical,
intent(in),
optional :: debug
774 integer :: ilat, ilon
778 character(len=255) :: asite
779 real,
dimension(:),
allocatable :: maero412, maero470, maero650
780 real,
dimension(:),
allocatable :: mbgaod
781 integer,
dimension(:),
allocatable :: msiteindx
782 integer,
dimension(:),
allocatable :: sorted
783 real :: ab412, ab470, ab650
784 real :: ac412, ac470, ac650
785 real :: xnorm_412_f1, xnorm_412_f2
786 real :: xnorm_470_f1, xnorm_470_f2
787 real :: frac, normfrac
788 real :: aod_corr_factor
789 integer :: i, ii, jj, cnt
794 real :: mb_sr412, mb_sr470, mb_sr650
795 real :: m_sr412, m_sr470, m_sr650
796 real :: v_sr412, v_sr488, v_sr670
799 if (
present(debug))
then
804 print *,
trim(func_name)//
', lat, lon, raa, scat, elev, month, ndvi, gzone, lc, sr412, sr470, sr650: ' &
805 & , lat, lon, ra, sa, elev, month, ndvi, gzone, lc_type, sr412, sr470, sr650
809 ilat = floor(lat*10.0) + 900 + 1
810 ilon = floor(lon*10.0) + 1800 + 1
812 if (ilat > 1800) ilat = 1800
813 if (ilon > 3600) ilon = 3600
814 if (dflag) print *,
trim(func_name)//
', lat, lon, ilat, ilon: ', lat, lon, ilat, ilon
827 print *,
"ERROR: Invalid month specified: ", month
833 refsr650 = brdf650(ilon,ilat)
837 m = count(aero_zones == gzone .AND. aero_types == lc_type .AND. (elev < 500 .EQV. aero_elev < 500))
840 if (gzone == 16 .OR. (gzone == 17 .OR. gzone == 2) .OR. gzone == 22)
then
841 m = count(aero_zones == gzone .AND. (elev < 500 .EQV. aero_elev < 500))
845 if (gzone == 18 .OR. gzone == 12 .OR. (gzone == 26 .OR. gzone == 27) .OR. gzone == 29)
then
846 m = count(aero_zones == gzone)
850 if (gzone == 28)
then
851 m = count(aero_zones == gzone)
855 if (gzone == 20)
then
856 m = count(aero_zones == gzone)
860 if (gzone == 30)
then
861 m = count(aero_zones == gzone)
865 if (gzone == 19)
then
866 m = count(aero_zones == gzone)
870 if (gzone == 15)
then
871 m = count(aero_zones == gzone)
876 if ((gzone == 5 .AND. lc_type == 2) .OR. gzone == 1 .or. gzone == 13)
then
877 m = count(aero_zones == gzone .AND. aero_types == lc_type)
881 if (gzone == 31 .AND. elev < 750)
then
882 m = count(aero_zones == gzone)
886 if (gzone /= 2 .AND. gzone /= 12 .AND. gzone /= 14 .AND. gzone /= 28 .AND. &
887 & gzone /= 10 .AND. gzone /= 20 .AND. gzone /= 30 .AND. gzone /= 31)
then
888 if (lc_type == 6) m = 0
895 if (
allocated(maero412))
deallocate(maero412, stat=status)
896 if (
allocated(maero470))
deallocate(maero470, stat=status)
897 if (
allocated(maero650))
deallocate(maero650, stat=status)
898 if (
allocated(mbgaod))
deallocate(mbgaod, stat=status)
899 if (
allocated(msiteindx))
deallocate(msiteindx, stat=status)
900 if (
allocated(sorted))
deallocate(sorted, stat=status)
901 allocate(maero412(m), maero470(m), maero650(m), mbgaod(m), msiteindx(m), &
902 sorted(m), stat=status)
903 if (status /= 0)
then
904 print *,
"ERROR: Failed to allocate AERONET 650 SR match arrays: ",status
911 do i = 1,
size(aero_sites)
914 if (aero_zones(i) == gzone .AND. (elev < 500 .EQV. aero_elev(i) < 500))
then
916 maero412(cnt) = aero_sr412(i,season)
917 maero470(cnt) = aero_sr470(i,season)
918 maero650(cnt) = aero_sr650(i,3)
919 mbgaod(cnt) = aero_bgaod(i,season)
923 print
'(A,A,A,I4,I4)',
trim(func_name),
', matching site: ',
trim(aero_sites(i)), aero_zones(i), aero_types(i)
924 print
'(A,A,3(F11.6,1X))',
trim(func_name),
', AERONET Baseline SR: ', maero412(cnt), maero470(cnt), maero650(cnt)
928 case (18, 12, 20, 26, 27, 28, 29, 30, 31)
929 if (aero_zones(i) == gzone)
then
931 maero412(cnt) = aero_sr412(i,season)
932 maero470(cnt) = aero_sr470(i,season)
933 maero650(cnt) = aero_sr650(i,3)
934 mbgaod(cnt) = aero_bgaod(i,season)
938 print
'(A,A,A,I4,I4)',
trim(func_name),
', matching site: ',
trim(aero_sites(i)), aero_zones(i), aero_types(i)
939 print
'(A,A,3(F11.6,1X))',
trim(func_name),
', AERONET Baseline SR: ', maero412(cnt), maero470(cnt), maero650(cnt)
944 if (aero_zones(i) == gzone)
then
946 maero412(cnt) = aero_sr412(i,season)
947 maero470(cnt) = aero_sr470(i,season)
948 maero650(cnt) = aero_sr650(i,3)
949 mbgaod(cnt) = aero_bgaod(i,season)
953 print
'(A,A,A,I4,I4)',
trim(func_name),
', matching site: ',
trim(aero_sites(i)), aero_zones(i), aero_types(i)
954 print
'(A,A,3(F11.6,1X))',
trim(func_name),
', AERONET Baseline SR: ', maero412(cnt), maero470(cnt), maero650(cnt)
959 if (aero_zones(i) == gzone .AND. aero_types(i) == lc_type)
then
961 maero412(cnt) = aero_sr412(i,season)
962 maero470(cnt) = aero_sr470(i,season)
963 maero650(cnt) = aero_sr650(i,3)
964 mbgaod(cnt) = aero_bgaod(i,season)
968 print
'(A,A,A,I4,I4)',
trim(func_name),
', matching site: ',
trim(aero_sites(i)), aero_zones(i), aero_types(i)
969 print
'(A,A,3(F11.6,1X))',
trim(func_name),
', AERONET Baseline SR: ', maero412(cnt), maero470(cnt), maero650(cnt)
974 if (aero_zones(i) == gzone .AND. aero_types(i) == lc_type .AND. (elev < 500 .EQV. aero_elev(i) < 500))
then
976 maero412(cnt) = aero_sr412(i,season)
977 maero470(cnt) = aero_sr470(i,season)
978 maero650(cnt) = aero_sr650(i,3)
979 mbgaod(cnt) = aero_bgaod(i,season)
983 print
'(A,A,A,I4,I4)',
trim(func_name),
', matching site: ',
trim(aero_sites(i)), aero_zones(i), aero_types(i)
984 print
'(A,A,3(F11.6,1X))',
trim(func_name),
', AERONET Baseline SR: ', maero412(cnt), maero470(cnt), maero650(cnt)
991 call sortrx(m, maero650, sorted)
992 if (refsr650 >= minval(maero650) .AND. refsr650 < maxval(maero650))
then
996 if (refsr650 >= maero650(sorted(i)) .AND. refsr650 < maero650(sorted(i+1)))
then
998 asite = aero_sites(msiteindx(ii))
999 status = get_aeronet_brdf_sr(asite, month, ra, sa, vza, ndvi, stdv, ab412, &
1000 & ab470, ab650, ac412, ac470, ac650, use_alternate_brdf, debug=dflag)
1001 if (status /= 0)
then
1002 print *,
"ERROR: Failed to get BRDF-corrected SR from AERONET site: ",
trim(asite), status
1006 xnorm_412_f1 = ab412 / maero412(ii)
1007 xnorm_470_f1 = ab470 / maero470(ii)
1010 asite = aero_sites(msiteindx(jj))
1011 status = get_aeronet_brdf_sr(asite, month, ra, sa, vza, ndvi, stdv, ab412, &
1012 & ab470, ab650, ac412, ac470, ac650, use_alternate_brdf, debug=dflag)
1013 if (status /= 0)
then
1014 print *,
"ERROR: Failed to get BRDF-corrected SR from AERONET site: ",
trim(asite), status
1018 xnorm_412_f2 = ab412 / maero412(jj)
1019 xnorm_470_f2 = ab470 / maero470(jj)
1022 frac = (refsr650-maero650(ii)) / (maero650(jj)-maero650(ii))
1024 normfrac = frac*xnorm_412_f2 + (1.0-frac)*xnorm_412_f1
1026 if (sr412 < -900.0)
then
1030 sr412 = sr412 * normfrac
1032 normfrac = frac*xnorm_470_f2 + (1.0-frac)*xnorm_470_f1
1034 if (sr470 < -900.0)
then
1038 sr470 = sr470 * normfrac
1043 print
'(A,A,F11.6)',
trim(func_name),
", Pixel Ref 650 SR: ", refsr650
1044 print
'(A,A,2(F11.6,1X))',
trim(func_name),
", Pixel Baseline SR, 412, 470: ", &
1046 print
'(4(A,1X))',
trim(func_name),
", interp sites: ", &
1047 &
trim(aero_sites(msiteindx(ii))),
trim(aero_sites(msiteindx(jj)))
1048 print
'(A,A,3(F11.6,1X))',
trim(func_name),
", calcsr412, aerosr412: ", sr412, maero412(ii), maero412(jj)
1049 print
'(A,A,3(F11.6,1X))',
trim(func_name),
", calcsr470, aerosr470: ", sr470, maero470(ii), maero470(jj)
1050 print
'(A,A,3(F11.6,1X))',
trim(func_name),
", calcsr650, aerosr650: ", sr650, maero650(ii), maero650(jj)
1051 print
'(A,A,2(F11.6,1X))',
trim(func_name),
", xnorm412: ", xnorm_412_f1, xnorm_412_f2
1052 print
'(A,A,2(F11.6,1X))',
trim(func_name),
", xnorm470: ", xnorm_470_f1, xnorm_470_f2
1062 if (refsr650 <= minval(maero650))
then
1068 asite = aero_sites(msiteindx(ii))
1069 status = get_aeronet_brdf_sr(asite, month, ra, sa, vza, ndvi, stdv, ab412, ab470, &
1070 & ab650, ac412, ac470, ac650, use_alternate_brdf, debug=dflag)
1071 if (status /= 0)
then
1072 print *,
"ERROR: Failed ot get BRDF-corrected SR from AERONET site, single: ",
trim(asite), status
1106 xnorm_412_f1 = ab412 / maero412(ii)
1110 if (sr412 < -900.0)
then
1114 sr412 = sr412 * xnorm_412_f1
1146 xnorm_470_f1 = ab470 / maero470(ii)
1150 if (sr470 < -900.0)
then
1154 sr470 = sr470 * xnorm_470_f1
1159 print
'(A,A,F11.6)',
trim(func_name),
", Pixel Ref 650 SR: ", refsr650
1160 print
'(A,A,2(F11.6,1X))',
trim(func_name),
", Pixel Baseline SR, 412, 470: ", &
1162 print
'(3(A,1X))',
trim(func_name),
", interp site: ",
trim(aero_sites(msiteindx(ii)))
1163 print
'(A,A,2(F11.6,1X))',
trim(func_name),
", calcsr412, aerosr412: ", sr412, maero412(ii)
1164 print
'(A,A,2(F11.6,1X))',
trim(func_name),
", calcsr470, aerosr470: ", sr470, maero470(ii)
1165 print
'(A,A,2(F11.6,1X))',
trim(func_name),
", calcsr650, aerosr650 : ", sr650, maero650(ii)
1166 print
'(A,A,F11.6)',
trim(func_name),
", xnorm412: ", xnorm_412_f1
1167 print
'(A,A,F11.6)',
trim(func_name),
", xnorm470: ", xnorm_470_f1
1168 print
'(A,A,2(F11.6,1X))',
trim(func_name),
", aerobrdf412, 470: ", ab412, ab470
1191 print
'(A,A,3(F10.4))',
trim(func_name),
"final SR412, SR470, SR650: ", sr412, sr470, sr650
1198 if (sr412 < 0.0 .OR. sr470 < 0.0)
then
1203 print *,
trim(func_name),
", table-based SR, 412, 470, 650: ", sr412, sr470, sr650
1204 print *,
trim(func_name),
", final status: ", status
1214 integer function get_aeronet_brdf_sr(aero_site, month, raa, sca, vza, ndvi, stdv, s412, s470, &
1215 & s650, c412, c470, c650, use_alternate_brdf, debug)
result(status)
1219 character(len=50),
parameter :: func_name =
"get_aeronet_brdf_sr"
1221 integer,
parameter :: ndegs = 4
1223 character(len=255),
intent(in) :: aero_site
1224 integer,
intent(in) :: month
1225 real,
intent(in) :: raa
1226 real,
intent(in) :: sca
1227 real,
intent(in) :: vza
1228 real,
intent(in) :: ndvi
1229 real,
intent(in) :: stdv
1230 real,
intent(inout) :: s412
1231 real,
intent(inout) :: s470
1232 real,
intent(inout) :: s650
1233 real,
intent(inout) :: c412
1234 real,
intent(inout) :: c470
1235 real,
intent(inout) :: c650
1239 logical,
intent(in),
optional :: use_alternate_brdf
1240 logical,
intent(in),
optional :: debug
1242 real,
dimension(ndegs) :: co412
1243 real,
dimension(ndegs) :: co470
1244 real,
dimension(ndegs) :: co650
1252 if (
present(debug))
then
1257 if (raa < 90.0)
then
1280 print *,
"ERROR: Invalid month specified: ", month
1285 co412 = (/-999.0,-999.0,-999.0,-999.0/)
1286 co470 = (/-999.0,-999.0,-999.0,-999.0/)
1287 co650 = (/-999.0,-999.0,-999.0,-999.0/)
1289 select case (aero_site)
1291 case (
"Banizoumbou")
1292 select case (season)
1294 if(ndvi >= 0.15)
then
1295 co470 = (/1.02169058e01, 4.243027e-02, 1.54773501e-04, 0.0/)
1296 co412 = (/6.56567239, 1.46437509e-02, 0.0, 0.0/)
1297 co650 = (/0.0, 0.0, 0.0, 0.0/)
1299 co412 = (/5.05991244, 4.90682739e-02,0.0,0.0/)
1300 co470 = (/9.33658552, 7.10523577e-02, -2.60069034e-05,0.0/)
1301 co650 = (/0.0, 0.0, 0.0, 0.0/)
1304 if (ndvi >= 0.12)
then
1305 co412 = (/6.39744066, 4.00276042e-02, 0.0, 0.0/)
1306 co470 = (/1.04021434e01, 5.37401649e-02, 1.11642009e-04, 0.0/)
1307 co650 = (/0.0, 0.0, 0.0, 0.0/)
1316 co412 = (/7.4842753, 0.0,0.0,0.0/)
1317 co470 = (/1.11423275e01, 8.99414273e-02, -7.65091516e-04, 0.0/)
1318 co650 = (/0.0, 0.0, 0.0, 0.0/)
1321 co412 = (/6.36294769, 5.40543846e-02, -1.71327907e-04, 0.0/)
1322 co470 = (/1.06517369e01, 6.01331952e-02, 0.0, 0.0/)
1340 if (ndvi >= 0.24)
then
1341 co412 = (/4.68590202, 4.79492301e-02, 0.0, 0.0/)
1342 co470 = (/7.65714295, 7.81415694e-02, -2.40306130e-04, 0.0/)
1343 co650 = (/0.0, 0.0, 0.0, 0.0/)
1345 co412 = (/4.78835211, 8.16497137e-02, -3.62862493e-04, 0.0/)
1346 co470 = (/9.02297785, 1.21271052e-01, -1.09555283e-03, 0.0/)
1347 co650 = (/0.0, 0.0, 0.0, 0.0/)
1351 co412 = (/4.33902797, 8.37586808e-02, -5.54927180e-04, 0.0/)
1352 co470 = (/9.25667223, 1.14446764e-01, -1.03215095e-03, 0.0/)
1353 co650 = (/0.0, 0.0, 0.0, 0.0/)
1358 if (ndvi >= 0.21)
then
1359 co412 = (/4.78430658, 3.2201042e-02, -1.62743787e-04, 6.68624319e-06/)
1360 co470 = (/7.8706363, 5.51922546e-02, 0.0, 0.0/)
1361 co650 = (/0.0, 0.0, 0.0, 0.0/)
1363 co412 = (/5.239379, 4.142642525e-02, 1.66142711e-05, 0.0/)
1364 co470 = (/9.09596194, 6.99428916e-02, -2.528929176e-04, 0.0/)
1365 co650 = (/0.0, 0.0, 0.0, 0.0/)
1368 print *,
"ERROR: Invalid season specified: ", season
1375 select case (season)
1377 co412 = (/4.5439484, 7.12450582e-2, 5.1565853e-4, 0.0/)
1378 co470 = (/5.1905870, 7.0479636e-2, -7.2117339e-4, 0.0/)
1379 co650 = (/0.0, 0.0, 0.0, 0.0/)
1381 co412 = (/4.0491380, 6.5488864e-2, -2.7752629e-4, 0.0/)
1382 co470 = (/5.5883717, 7.6432090e-2, 3.1404959e-5, 0.0/)
1383 co650 = (/0.0, 0.0, 0.0, 0.0/)
1386 co412 = (/4.7996805, 6.3598622e-2, -8.9915671e-6, 0.0/)
1387 co470 = (/5.6717516, 6.6228202e-2, 3.5839652e-4 , 0.0/)
1388 co650 = (/0.0, 0.0, 0.0, 0.0/)
1394 co412 = (/4.7996805, 6.3598622e-2, -8.9915671e-6, 0.0/)
1395 co470 = (/5.6717516, 6.6228202e-2, 3.5839652e-4 , 0.0/)
1396 co650 = (/0.0, 0.0, 0.0, 0.0/)
1398 print *,
"ERROR: Invalid season specified: ", season
1404 case (
"IER_Cinzana")
1405 select case (season)
1407 if (ndvi >= 0.2)
then
1408 co412 = (/3.63552866, 3.80334634e-2, 0.0, 0.0/)
1409 co470 = (/7.1468792, 4.90084709e-2, -5.8487537e-4, 2.65330779e-5/)
1410 co650 = (/0.0, 0.0, 0.0, 0.0/)
1412 co412 = (/3.50830056, 4.45759847e-2, 0.0, 0.0/)
1413 co470 = (/7.2185198, 7.14231475e-2, 0.0, 0.0/)
1414 co650 = (/0.0, 0.0, 0.0, 0.0/)
1417 if(ndvi >= 0.18)
then
1418 co412 = (/8.03123187, 6.31014685e-2, -3.03999188e-4, 0.0/)
1419 co470 = (/8.00850678, 5.36508158e-2, 0.0, 0.0/)
1420 co650 = (/0.0, 0.0, 0.0, 0.0/)
1422 co412 = (/4.78540468, 4.53379041e-2, 0.0, 0.0/)
1423 co470 = (/8.55690294, 6.26426162e-2, 0.0, 0.0/)
1424 co650 = (/0.0, 0.0, 0.0, 0.0/)
1427 if (ndvi >= 0.3)
then
1428 co412 = (/3.56969498, 1.48750348e-2, 0.0, 0.0/)
1429 co470 = (/5.218741, 3.68430117e-2, 0.0, 0.0/)
1430 co650 = (/0.0, 0.0, 0.0, 0.0/)
1432 co412 = (/4.1364437, 3.54993284e-2, 0.0, 0.0/)
1433 co470 = (/7.68177478, 5.48823787e-2, 0.0, 0.0/)
1434 co650 = (/0.0, 0.0, 0.0, 0.0/)
1438 if (ndvi < 0.36)
then
1439 co412 = (/3.3600304, 4.07091256e-2, -6.36564712e-4, 0.0/)
1440 co470 = (/6.00156726, 5.32555429e-2, -2.03417949e-4, 0.0/)
1441 co650 = (/0.0, 0.0, 0.0, 0.0/)
1442 else if(ndvi < 0.48)
then
1443 co412 = (/2.75902271, 5.86471497e-3, 8.9298557e-4, -2.84768722e-6/)
1444 co470 = (/4.49584493, 3.2333347e-2, 1.68247099e-3, -2.08146852e-5/)
1445 co650 = (/0.0, 0.0, 0.0, 0.0/)
1447 co412 = (/2.54155592, 0.0, 0.0, 0.0/)
1448 co470 = (/4.08158909, 7.65889923e-3, 0.0, 0.0/)
1449 co650 = (/0.0, 0.0, 0.0, 0.0/)
1452 print *,
"ERROR: Invalid season specified: ", season
1458 case (
"Zinder_Airport")
1459 select case (season)
1461 if (ndvi >= 0.15)
then
1462 co412 = (/5.74980283, 2.39050366e-02, 0.0, 0.0/)
1463 co470 = (/1.00530139e01, 5.17129972e-02, 0.0, 0.0/)
1464 co650 = (/0.0, 0.0, 0.0, 0.0/)
1466 co412 = (/5.86499038, 4.16328036e-02, 0.0, 0.0/)
1467 co470 = (/1.07113413e01, 6.94885771e-02, -2.12100636e-04, 0.0/)
1468 co650 = (/0.0, 0.0, 0.0, 0.0/)
1471 co412 = (/5.48605593, 7.32715822e-02, -3.94126361e-04, 0.0/)
1472 co470 = (/1.02289147e01, 7.179364421e-02, 0.0, 0.0/)
1473 co650 = (/0.0, 0.0, 0.0, 0.0/)
1475 if (ndvi >= 0.24)
then
1476 co412 = (/3.72175525, 1.33333812e-03, 0.0, 0.0/)
1477 co470 = (/6.28406012, 6.05189262e-02, 0.0, 0.0/)
1478 co650 = (/0.0, 0.0, 0.0, 0.0/)
1480 else if (ndvi >= 0.15)
then
1481 co412 = (/9.14958326, -6.22526837e-03, 0.0, 0.0/)
1482 co470 = (/1.22197489e01, 3.78885944e-02, 0.0, 0.0/)
1483 co650 = (/0.0, 0.0, 0.0, 0.0/)
1489 co412 = (/5.21423049, 8.21993929e-02, -3.75107523e-04, 0.0/)
1490 co470 = (/9.78066195, 8.69504404e-02, -3.28108722e-04, 0.0/)
1491 co650 = (/0.0, 0.0, 0.0, 0.0/)
1495 if (ndvi >= 0.24)
then
1496 co412 = (/2.07354907, 5.40878937e-02, 0.0, 0.0/)
1497 co470 = (/5.31006297, 8.37948079e-02, 0.0, 0.0/)
1498 co650 = (/0.0, 0.0, 0.0, 0.0/)
1500 co412 = (/5.05835071, 1.82023167e-02, -6.29515824e-04, 2.93686368e-05/)
1501 co470 = (/9.26108740, 6.81130675e-02, 0.0, 0.0/)
1502 co650 = (/0.0, 0.0, 0.0, 0.0/)
1505 print *,
"ERROR: Invalid season specified: ", season
1512 select case (season)
1514 co412 = (/6.3014686, 4.1543979e-2, 1.1858985e-4, 0.0/)
1515 co470 = (/7.4044324, 8.1265848e-2, 4.9485414e-4, 0.0/)
1516 co650 = (/0.0, 0.0, 0.0, 0.0/)
1518 if (ndvi < 0.18)
then
1519 co412 = (/5.89152474, 4.52651696e-2, 2.68647127e-4, 0.0/)
1520 co470 = (/7.30775670, 7.62461937e-2, -3.21229444e-4, 0.0/)
1521 co650 = (/0.0, 0.0, 0.0, 0.0/)
1523 co412 = (/5.30165348, 2.39439950e-2, 7.06604780e-4, 0.0/)
1524 co470 = (/6.28190845, 6.15060495e-2, 1.20706642e-4, 0.0/)
1525 co650 = (/0.0, 0.0, 0.0, 0.0/)
1528 co412 = (/5.6957808, 5.3492403e-2, -2.1731312e-4, 0.0/)
1529 co470 = (/6.1378929, 7.4536939e-2, -3.7338370e-4, 0.0/)
1530 co650 = (/0.0, 0.0, 0.0, 0.0/)
1532 co412 = (/5.4468575, 4.9992086e-2, 1.0863964e-05, 0.0/)
1533 co470 = (/6.1302000, 6.7842888e-2, 6.9728565e-05, 0.0/)
1534 co650 = (/0.0, 0.0, 0.0, 0.0/)
1536 print *,
"ERROR: Invalid season specified: ", season
1543 select case (season)
1545 co412 = (/10.226094, -0.14939743, 0.0064489043, -7.3014348e-05/)
1546 co470 = (/14.875093, 0.046262226, -0.0010471590, 1.1772507e-05/)
1547 co650 = (/34.573460, 0.39409698, -0.017102505, 0.00021277064/)
1552 co412 = (/7.1646428, 0.15052042, -0.0043741791, 4.4118414e-05/)
1553 co470 = (/12.347033, 0.22954843, -0.0069846621, 7.1241796e-05/)
1554 co650 = (/34.616283, 0.042627358, -0.0013109076, 2.2689966e-05/)
1559 co412 = (/12.806989, -0.46510965, 0.016412267, -0.00016780296/)
1560 co470 = (/19.796796, -0.62064603, 0.021296302, -0.00021068886/)
1561 co650 = (/32.705724, 0.12309721, -0.0029126864, 3.7611775e-05/)
1566 co412 = (/8.4939626, 0.062900115, -0.0016468367, 1.5106109e-05/)
1567 co470 = (/15.206425, 0.020553284, -0.0013703752, 2.2283588e-05/)
1568 co650 = (/34.954706, 0.17635488, -0.0058044940, 5.6107481e-05/)
1573 print *,
"ERROR: Invalid season specified: ", season
1580 select case (season)
1582 co412 = (/5.80751073, 4.06728637e-02, 4.24590213e-05, 0.0/)
1583 co470 = (/7.20443297, 7.07862547e-02, 5.50556530e-04, 0.0/)
1584 co650 = (/0.0, 0.0, 0.0, 0.0/)
1591 co412 = (/5.10554282, 3.12540398e-02, 3.70094580e-04, 0.0/)
1592 co470 = (/6.98775847, 6.37364825e-02, -5.27383741e-05, 0.0/)
1593 co650 = (/0.0, 0.0, 0.0, 0.0/)
1601 co412 = (/4.76062810, 4.07850599e-02, 0.0, 0.0/)
1602 co470 = (/6.85966085, 5.99596507e-02, -8.44790522e-04, 2.47006074e-05/)
1603 co650 = (/0.0, 0.0, 0.0, 0.0/)
1611 co412 = (/4.53821328, 2.89784912e-02, 6.46309542e-04, 0.0/)
1612 co470 = (/6.80695142, 5.35553957e-02, 1.21293340e-04, 5.95530797e-06/)
1613 co650 = (/0.0, 0.0, 0.0, 0.0/)
1616 print *,
"ERROR: Invalid season specified: ", season
1622 case (
"Fresno_GZ18")
1623 select case (season)
1625 co412 = (/5.80751073, 4.06728637e-02, 4.24590213e-05, 0.0/)
1626 co470 = (/7.20443297, 7.07862547e-02, 5.50556530e-04, 0.0/)
1627 co650 = (/0.0, 0.0, 0.0, 0.0/)
1629 if (ndvi < 0.28)
then
1630 co412 = (/6.40431062, 3.72488428e-02, -1.66166477e-03, 3.28633059e-05/)
1631 co470 = (/7.69437062, 6.82783655e-02, -6.49639866e-04, 7.40504460e-06/)
1632 co650 = (/0.0, 0.0, 0.0, 0.0/)
1634 co412 = (/5.10554282, 3.12540398e-02, 3.70094580e-04, 0.0/)
1635 co470 = (/6.98775847, 6.37364825e-02, -5.27383741e-05, 0.0/)
1636 co650 = (/0.0, 0.0, 0.0, 0.0/)
1639 if (ndvi < 0.28)
then
1640 co412 = (/5.58406544, 1.61289652e-02, 6.22273421e-04, 0.0/)
1641 co470 = (/7.11813056, 4.77749714e-02, 4.23934048e-04, 0.0/)
1642 co650 = (/0.0, 0.0, 0.0, 0.0/)
1644 co412 = (/4.76062810, 4.07850599e-02, 0.0, 0.0/)
1645 co470 = (/6.85966085, 5.99596507e-02, -8.44790522e-04, 2.47006074e-05/)
1646 co650 = (/0.0, 0.0, 0.0, 0.0/)
1649 if (ndvi < 0.27)
then
1650 co412 = (/4.63756258, 4.98512265e-02, 0.0, 0.0/)
1651 co470 = (/6.85551799, 5.0385959e-02, -1.39476331e-04, 2.59945517e-05/)
1652 co650 = (/0.0, 0.0, 0.0, 0.0/)
1654 co412 = (/4.53821328, 2.89784912e-02, 6.46309542e-04, 0.0/)
1655 co470 = (/6.80695142, 5.35553957e-02, 1.21293340e-04, 5.95530797e-06/)
1656 co650 = (/0.0, 0.0, 0.0, 0.0/)
1659 print *,
"ERROR: Invalid season specified: ", season
1666 select case (season)
1668 co412 = (/6.9337283, 4.4282749e-02, 1.4061984e-03, 0.0/)
1669 co470 = (/7.3485598, 6.9214518e-02, 1.8788394e-03, 0.0/)
1670 co650 = (/0.0, 0.0, 0.0, 0.0/)
1672 co412 = (/6.5373929, 2.6971498e-02, -7.8218577e-05, 0.0/)
1673 co470 = (/7.2815217, 4.3698874e-02, -2.7398479e-04, 0.0/)
1674 co650 = (/0.0, 0.0, 0.0, 0.0/)
1676 co412 = (/6.6297657, 3.1107265e-02, -1.2153919e-04, 0.0/)
1677 co470 = (/6.8517577, 5.2723244e-02, -4.9795072e-04, 0.0/)
1678 co650 = (/0.0, 0.0, 0.0, 0.0/)
1680 co412 = (/6.1744159, 1.5031182e-02, 0.0, 0.0/)
1681 co470 = (/6.7001040, 2.5827169e-02, 0.0, 0.0/)
1682 co650 = (/0.0, 0.0, 0.0, 0.0/)
1684 print *,
"ERROR: Invalid season specified: ", season
1692 select case (season)
1694 co412 = (/4.79872574, -1.56512429e-02, -1.23860221e-03, 5.84017625e-05/)
1695 co470 = (/8.05072532, 1.61294620e-02, -6.57200682e-04, 4.10211916e-05/)
1696 co650 = (/0.0, 0.0, 0.0, 0.0/)
1698 co412 = (/5.34279489, 2.40838594e-03, 0.0, 0.0/)
1699 co470 = (/8.28211141, 2.88113903e-02, 0.0, 0.0/)
1700 co650 = (/0.0, 0.0, 0.0, 0.0/)
1702 if (ndvi >= 0.24)
then
1703 co412 = (/3.26738286, 4.36827818e-02, -1.55895303e-04, -1.20224162e-05/)
1704 co470 = (/5.03384478, 7.29893383e-02, 1.31678743e-03, -4.31578699e-05/)
1705 co650 = (/0.0, 0.0, 0.0, 0.0/)
1707 co412 = (/4.49283427, 4.04848382e-05, -3.09039795e-04, 1.65524662e-05/)
1708 co470 = (/7.34716100, 4.10633137e-02, 2.51289909e-04, -3.32283482e-06/)
1709 co650 = (/0.0, 0.0, 0.0, 0.0/)
1712 if (ndvi >= 0.21)
then
1713 co412 = (/3.21406439, 2.84017859e-02, 2.25979209e-04, -1.35954941e-05/)
1714 co470 = (/5.32086992, 5.10973584e-02, 1.23563583e-03, -3.14731061e-05/)
1715 co650 = (/0.0, 0.0, 0.0, 0.0/)
1716 else if (ndvi >= 0.18)
then
1717 co412 = (/4.03496081, -1.16119226e-02, -4.21409772e-04, 3.26077680e-05/)
1718 co470 = (/6.89540010, 3.44825524e-02, 4.25223284e-04, 0.0/)
1719 co650 = (/0.0, 0.0, 0.0, 0.0/)
1721 co412 = (/4.68551647, 3.37375535e-03, 3.28094666e-04, 0.0/)
1722 co470 = (/7.97076041, 4.07903024e-02, 0.0, 0.0/)
1723 co650 = (/0.0, 0.0, 0.0, 0.0/)
1726 print *,
"ERROR: Invalid season specified: ", season
1732 select case (season)
1734 co412 = (/4.79872574, -1.56512429e-02, -1.23860221e-03, 5.84017625e-05/)
1735 co470 = (/8.05072532, 1.61294620e-02, -6.57200682e-04, 4.10211916e-05/)
1736 co650 = (/0.0, 0.0, 0.0, 0.0/)
1738 co412 = (/5.31125838, 1.14257083e-02, 0.0, 0.0/)
1739 co470 = (/8.30402936, 4.22170099e-02, 0.0, 0.0/)
1740 co650 = (/0.0, 0.0, 0.0, 0.0/)
1742 if (ndvi >= 0.24)
then
1743 co412 = (/3.26738286, 4.36827818e-02, -1.55895303e-04, -1.20224162e-05/)
1744 co470 = (/5.03384478, 7.29893383e-02, 1.31678743e-03, -4.31578699e-05/)
1745 co650 = (/0.0, 0.0, 0.0, 0.0/)
1747 co412 = (/4.49283427, 4.04848382e-05, -3.09039795e-04, 1.65524662e-05/)
1748 co470 = (/7.34716100, 4.10633137e-02, 2.51289909e-04, -3.32283482e-06/)
1749 co650 = (/0.0, 0.0, 0.0, 0.0/)
1752 if (ndvi >= 0.21)
then
1753 co412 = (/3.21406439, 2.84017859e-02, 2.25979209e-04, -1.35954941e-05/)
1754 co470 = (/5.32086992, 5.10973584e-02, 1.23563583e-03, -3.14731061e-05/)
1755 co650 = (/0.0, 0.0, 0.0, 0.0/)
1756 else if (ndvi >= 0.18)
then
1757 co412 = (/4.03496081, -1.16119226e-02, -4.21409772e-04, 3.26077680e-05/)
1758 co470 = (/6.89540010, 3.44825524e-02, 4.25223284e-04, 0.0/)
1759 co650 = (/0.0, 0.0, 0.0, 0.0/)
1761 co412 = (/4.68551647, 3.37375535e-03, 3.28094666e-04, 0.0/)
1762 co470 = (/7.97076041, 4.07903024e-02, 0.0, 0.0/)
1763 co650 = (/0.0, 0.0, 0.0, 0.0/)
1766 print *,
"ERROR: Invalid season specified: ", season
1773 case (
"Tinga_Tingana")
1775 select case (season)
1777 if (ndvi >= 0.13)
then
1778 co412 = (/9.20413537, -5.17086422e-03, 1.02106845e-04, 0.0/)
1779 co470 = (/1.22306875e01, 4.82832263e-02, 3.68569587e-04, 0.0/)
1780 co650 = (/0.0, 0.0, 0.0, 0.0/)
1782 co412 = (/9.43803716, -3.72278076e-03 , 0.0, 0.0/)
1783 co470 = (/1.27377047e01, 8.35333189e-03, 0.0, 0.0/)
1784 co650 = (/0.0, 0.0, 0.0, 0.0/)
1787 if (ndvi >= 0.18)
then
1788 co412 = (/8.92737977, 1.76851898e-02, 0.0, 0.0/)
1789 co470 = (/12.634865, 0.028769372, -0.00041455473, -3.2556186e-05/)
1790 co650 = (/0.0, 0.0, 0.0, 0.0/)
1792 co412 = (/9.37232462, -9.65154143e-03, -1.74009834e-04, 0.0/)
1793 co470 = (/12.634865, 0.028769372, -0.00041455473, -3.2556186e-05/)
1794 co650 = (/0.0, 0.0, 0.0, 0.0/)
1797 if (ndvi >= 0.20)
then
1798 co412 = (/7.81846282, 3.15351932e-03, 0.0, 0.0/)
1799 co470 = (/1.08279281e01, 1.57698665e-02, 0.0, 0.0/)
1800 co650 = (/0.0, 0.0, 0.0, 0.0/)
1801 else if (ndvi >= 0.14)
then
1802 co412 = (/8.88977803, 1.51799616e-03, -7.23417787e-05, 0.0/)
1803 co470 = (/1.20676913e01, 2.91883388e-02, 0.0, 0.0/)
1804 co650 = (/0.0, 0.0, 0.0, 0.0/)
1806 co412 = (/9.08868817, -4.17799194e-02, -8.09302376e-04, 0.0/)
1807 co470 = (/1.25503323e01, -3.95329882e-02, -1.77305946e-03, 0.0/)
1808 co650 = (/0.0, 0.0, 0.0, 0.0/)
1811 if (ndvi >= 0.14)
then
1812 co412 = (/8.87184595, -1.57754324e-02, 0.0, 0.0/)
1813 co470 = (/1.19334546e01, 8.68690821e-03, 0.0, 0.0/)
1814 co650 = (/0.0, 0.0, 0.0, 0.0/)
1816 co412 = (/9.09342651, -4.17208574e-02, 0.0, 0.0/)
1817 co470 = (/1.23033719e01, -5.36893150e-02, -8.53259219e-04, 7.49332728e-05/)
1818 co650 = (/0.0, 0.0, 0.0, 0.0/)
1821 print *,
"ERROR: Invalid season specified: ", season
1827 select case (season)
1829 if (ndvi >= 0.12)
then
1830 co412 = (/9.41470858, -2.15844867e-03, -1.82266839e-04, 1.21977424e-05/)
1831 co470 = (/1.2501821e01, 4.02391785e-02, 2.08696099e-04, 1.11738774e-06/)
1832 co650 = (/0.0, 0.0, 0.0, 0.0/)
1834 co412 = (/1.02358733e01, 7.77620010e-02, -1.98193828e-03, 0.0/)
1835 co470 = (/1.36183155e01, 4.05909269e-02, 0.0, 0.0/)
1836 co650 = (/0.0, 0.0, 0.0, 0.0/)
1839 if (ndvi >= 0.18)
then
1840 co412 = (/7.98223150, 1.40752752e-02, 2.69501591e-03, 0.0/)
1841 co470 = (/1.25564034e01, 5.50899365e-02, 0.0, 0.0/)
1842 co650 = (/0.0, 0.0, 0.0, 0.0/)
1844 co412 = (/9.42624421, 1.27763170e-02, 3.65495933e-04, -1.96877371e-05/)
1845 co470 = (/1.30602664e01, 7.57287787e-02, 4.73549830e-04, -6.40350281e-05/)
1846 co650 = (/0.0, 0.0, 0.0, 0.0/)
1849 if (ndvi >= 0.20)
then
1850 co412 = (/7.89996147, -8.14332506e-03, -7.83342101e-04, 0.0/)
1851 co470 = (/1.13849147e01, 3.69927333e-02, -3.88390040e-04, 0.0/)
1852 co650 = (/0.0, 0.0, 0.0, 0.0/)
1853 else if (ndvi >= 0.14)
then
1854 co412 = (/8.64034181, 1.67726763e-03, 5.88861610e-04, 0.0/)
1855 co470 = (/1.24428324e01, 3.71238324e-02, -6.76748814e-04, 0.0/)
1856 co650 = (/0.0, 0.0, 0.0, 0.0/)
1859 co412 = (/9.41753918, -2.67338094e-02, -8.88155712e-04, 0.0/)
1860 co470 = (/1.34852983e01, 1.12436978e-02, -1.61943826e-03, 0.0/)
1861 co650 = (/0.0, 0.0, 0.0, 0.0/)
1864 if (ndvi >= 0.14)
then
1865 co412 = (/8.83070860, -1.51364763e-03, 8.54079578e-04, 0.0/)
1866 co470 = (/1.20956002e01, 3.68362395e-02, 7.40851587e-04, 0.0/)
1867 co650 = (/0.0, 0.0, 0.0, 0.0/)
1869 co412 = (/8.88610258, -2.01943966e-02, 1.61198594e-03, 4.14828495e-06/)
1870 co470 = (/1.20856901e01, 3.26791012e-02, 2.03660386e-03, -1.72052223e-05/)
1871 co650 = (/0.0, 0.0, 0.0, 0.0/)
1874 print *,
"ERROR: Invalid season specified: ", season
1881 select case (season)
1883 co412 = (/6.08251454, 8.6508708e-02, 1.4521957e-03, 0.0/)
1884 co470 = (/5.80924919, 6.4047214e-02, 1.4495468e-03, 0.0/)
1885 co650 = (/0.0, 0.0, 0.0, 0.0/)
1887 if (ndvi >= 0.3)
then
1888 co412 = (/4.59092762, 3.22065937e-2, 1.72682251e-4, 0.0/)
1889 co470 = (/5.18390073, 5.80489830e-2, -2.1862814e-4, 0.0/)
1890 co650 = (/0.0, 0.0, 0.0, 0.0/)
1892 co412 = (/5.34520098, 3.28317599e-2, 3.17897070e-4, 0.0/)
1893 co470 = (/6.08505785, 5.89311646e-2, 2.59308378e-4, 0.0/)
1894 co650 = (/0.0, 0.0, 0.0, 0.0/)
1897 co412 = (/4.41373796, 2.74747266e-2, -9.0896914e-5, 0.0/)
1898 co470 = (/4.84420545, 4.30808241e-2, -5.4624034e-5, 0.0/)
1899 co650 = (/0.0, 0.0, 0.0, 0.0/)
1901 if (ndvi >= 0.3)
then
1902 co412 = (/4.45954687, 2.77637428e-2, 7.73159082e-4, 0.0/)
1903 co470 = (/5.06433779, 5.27772907e-2, 7.80966442e-4, 0.0/)
1904 co650 = (/0.0, 0.0, 0.0, 0.0/)
1906 co412 = (/5.22111926, 9.79821719e-2, 2.74956928e-3, 0.0/)
1907 co470 = (/5.63105884, 1.20658024e-1, 2.76971745e-3, 0.0/)
1908 co650 = (/0.0, 0.0, 0.0, 0.0/)
1911 print *,
"ERROR: Invalid season specified: ", season
1918 select case (season)
1920 co412 = (/4.8756241, 6.2534569e-2, 1.3572766e-3, 0.0/)
1921 co470 = (/5.4655822, 9.2120653e-2, 2.2203512e-3, 0.0/)
1922 co650 = (/0.0, 0.0, 0.0, 0.0/)
1924 co412 = (/5.0263816, 2.5373434e-2, 3.9146226e-4, 0.0/)
1925 co470 = (/5.4623850, 3.9852901e-2, 2.4863178e-4, 0.0/)
1926 co650 = (/0.0, 0.0, 0.0, 0.0/)
1928 co412 = (/5.1737469, 3.5232032e-2, -2.7832108e-4, 0.0/)
1929 co470 = (/5.4415591, 5.7405000e-2, -3.7084290e-4, 0.0/)
1930 co650 = (/0.0, 0.0, 0.0, 0.0/)
1932 co412 = (/3.57525283, 4.76106748e-2, 0.0, 0.0/)
1933 co470 = (/5.07540158, 6.07470043e-2, 0.0, 0.0/)
1934 co650 = (/0.0, 0.0, 0.0, 0.0/)
1936 print *,
"ERROR: Invalid season specified: ", season
1943 select case (season)
1945 co412 = (/2.94840397, 7.50469276e-02, -8.55631487e-03, 2.27740054e-04/)
1946 co470 = (/3.84084962, 2.46123068e-02, -3.93096482e-03, 1.39839185e-04/)
1947 co650 = (/5.32222028, 4.87768133e-02, 4.22486516e-03, -1.01546887e-04/)
1952 if (ndvi < 0.42)
then
1953 co412 = (/2.13608185, -1.16229203e-02, 2.94401536e-03, -4.50006125e-05/)
1954 co470 = (/2.49471720, 2.33437868e-02, 3.68220345e-03, -7.55117909e-05/)
1955 co650 = (/3.45073310, 2.58147011e-01, -6.23027605e-03, 5.75888737e-05/)
1957 co412 = (/2.23138624, -4.08180960e-02, 2.65231326e-03, -3.66271249e-05/)
1958 co470 = (/2.53458698, -5.68549547e-03, 1.36468352e-03, -1.8128715e-05/)
1959 co650 = (/3.3522585, 1.75290271e-02, 3.74108282e-04, -4.21350245e-06/)
1965 co412 = (/5.85428528, -4.40189848e-01, 1.40438945e-02, -1.30337719e-04/)
1966 co470 = (/5.56715596, -3.51677373e-01, 1.13826478e-02, -1.01625742e-04/)
1967 co650 = (/5.32153704, -2.47300042e-01, 8.34454443e-03, -6.98915803e-05/)
1972 co412 = (/9.78051816e-01, 3.83718088e-03, 2.03033445e-03, -3.88452812e-05/)
1973 co470 = (/1.34514727, 2.32911980e-02, 2.02551784e-03, -3.87492873e-05/)
1974 co650 = (/2.47427232, 4.49367275e-02, 1.42347421e-03, -3.36743928e-05/)
1979 print *,
"ERROR: Invalid season specified: ", season
1987 select case (season)
1989 if (ndvi >= 0.3)
then
1990 co412 = (/2.64678353, 0.0, 0.0, 0.0/)
1991 co470 = (/4.30869805, 2.23352643e-02, -3.08512532e-05, 0.0/)
1992 co650 = (/0.0, 0.0, 0.0, 0.0/)
1994 co412 = (/2.89503206, -1.10265858e-02, 8.83157740e-05, 4.86510471e-05/)
1995 co470 = (/4.85292481, 1.80204315e-02, -7.41860898e-05, 4.92511685e-05/)
1996 co650 = (/0.0, 0.0, 0.0, 0.0/)
1999 if (ndvi < 0.32)
then
2000 co412 = (/4.18631389, 2.5289862e-02, -9.62343375e-04, 3.39909450e-05/)
2001 co470 = (/5.32132814, 5.63754659e-02, -9.39866104e-04, 2.88986833e-05/)
2002 co650 = (/0.0, 0.0, 0.0, 0.0/)
2003 else if (ndvi >= 0.32 .AND. ndvi < 0.36)
then
2004 co412 = (/4.06688221, -1.77611644e-02, 0.0, 0.0/)
2005 co470 = (/4.97204509, 8.48689442e-03, 7.25410501e-04, 0.0/)
2006 co650 = (/0.0, 0.0, 0.0, 0.0/)
2008 co412 = (/3.42376327, -1.99413791e-02, 0.0, 0.0/)
2009 co470 = (/4.27929238, 2.86227327e-02, 0.0, 0.0/)
2010 co650 = (/0.0, 0.0, 0.0, 0.0/)
2013 if (ndvi < 0.27)
then
2014 co412 = (/4.37627766, 8.01305335e-03, 8.12666253e-04, -1.00058657e-05/)
2015 co470 = (/5.52675332, 4.58968534e-02, 5.09676314e-04, -9.71283147e-06/)
2016 co650 = (/0.0, 0.0, 0.0, 0.0/)
2018 co412 = (/4.31991803, -4.05160123e-02, 2.50853131e-03, -4.14415804e-05/)
2019 co470 = (/5.20304491, 3.31189616e-02, 2.11258050e-04, 0.0/)
2020 co650 = (/0.0, 0.0, 0.0, 0.0/)
2023 if (ndvi < 0.27)
then
2024 co412 = (/3.90506839, 0.0, 0.0, 0.0/)
2025 co470 = (/4.55176618, 0.0, 0.0, 0.0/)
2026 co650 = (/0.0, 0.0, 0.0, 0.0/)
2028 co412 = (/3.71875289, 1.75827423e-03, 0.0, 0.0/)
2029 co470 = (/5.24692412, 4.20630300e-02, 0.0, 0.0/)
2030 co650 = (/0.0, 0.0, 0.0, 0.0/)
2033 print *,
"ERROR: Invalid season specified: ", season
2038 select case (season)
2040 if (ndvi >= 0.3)
then
2041 co412 = (/2.40043582, -3.33151038e-02, 9.09508864e-04, 4.12504587e-05/)
2042 co470 = (/4.25935855, 9.65676859e-03, 2.92691096e-04, 2.94546746e-05/)
2043 co650 = (/0.0, 0.0, 0.0, 0.0/)
2045 co412 = (/2.79446907, 0.0, 0.0, 0.0/)
2046 co470 = (/4.85292481, 1.80204315e-02, -7.41860898e-05, 4.92511685e-05/)
2047 co650 = (/0.0, 0.0, 0.0, 0.0/)
2050 if (ndvi < 0.32)
then
2051 co412 = (/3.77066492, 1.58922076e-02, 3.03098949e-04, 0.0/)
2052 co470 = (/5.03028472, 5.31452578e-02, 1.26507640e-04, 0.0/)
2053 co650 = (/0.0, 0.0, 0.0, 0.0/)
2054 else if (ndvi >= 0.32 .AND. ndvi < 0.36)
then
2055 co412 = (/4.15714313, -1.65945058e-02, -3.80237318e-04, 1.50147243e-05/)
2056 co470 = (/5.00549166, 1.15932385e-02, 6.83756479e-04, 0.0/)
2057 co650 = (/0.0, 0.0, 0.0, 0.0/)
2059 co412 = (/3.09370523, -3.88747605e-02, 1.03242387e-03, 0.0/)
2060 co470 = (/4.35868847, 1.25746607e-02, -9.70954354e-04, 4.01565514e-05/)
2061 co650 = (/0.0, 0.0, 0.0, 0.0/)
2064 if (ndvi < 0.27)
then
2065 co412 = (/4.42122008, -1.43446348e-03, -1.26690140e-04, 1.39839144e-05/)
2066 co470 = (/5.56874754, 3.92057334e-02, -2.26222735e-04, 1.30731833e-05/)
2067 co650 = (/0.0, 0.0, 0.0, 0.0/)
2069 co412 = (/4.45603717, -3.60020814e-02, 8.76708868e-04, 0.0/)
2070 co470 = (/5.16502610, 2.56647090e-02, 6.43566423e-04, 0.0/)
2071 co650 = (/0.0, 0.0, 0.0, 0.0/)
2074 if (ndvi < 0.27)
then
2075 co412 = (/3.16438602, 6.46839077e-02, 0.0, 0.0/)
2076 co470 = (/4.63876927, 9.09174541e-02, 0.0, 0.0/)
2077 co650 = (/0.0, 0.0, 0.0, 0.0/)
2079 co412 = (/3.45291249, -2.23746051e-03, 6.18819075e-04, 0.0/)
2080 co470 = (/5.09438639, 3.96335945e-02, 3.59544361e-04, 0.0/)
2081 co650 = (/0.0, 0.0, 0.0, 0.0/)
2084 print *,
"ERROR: Invalid season specified: ", season
2092 select case (season)
2094 if (ndvi < 0.28)
then
2095 co412 = (/2.68778125, 3.16549893e-02,0.0,0.0/)
2096 co470 = (/5.44559746,0.0,0.0,0.0/)
2097 co650 = (/0.0, 0.0, 0.0, 0.0/)
2099 co412 = (/2.94527862, 0.0,0.0,0.0/)
2100 co470 = (/5.422391543, 7.49454787e-03,0.0,0.0/)
2101 co650 = (/0.0, 0.0, 0.0, 0.0/)
2105 if (ndvi >= 0.5)
then
2106 co412 = (/2.11712331, 1.89785795e-02, -3.36702190e-04, 1.02791555e-05/)
2107 co470 = (/4.12074484, 3.94824004e-02, 0.0, 0.0/)
2108 co650 = (/0.0, 0.0, 0.0, 0.0/)
2110 else if (ndvi < 0.4)
then
2111 co412 = (/3.38904321, 2.76987802e-02, 0.0, 0.0/)
2112 co470 = (/6.42545968, 5.19763334e-02, 0.0, 0.0/)
2113 co650 = (/0.0, 0.0, 0.0, 0.0/)
2115 co412 = (/2.43331357, 3.25327465e-02, 0.0, 0.0/)
2116 co470 = (/4.76639599, 4.15582016e-02, 1.11252132e-04, 0.0/)
2117 co650 = (/0.0, 0.0, 0.0, 0.0/)
2121 if (ndvi >= 0.32)
then
2122 co412 = (/2.84519284, 2.72442032e-2, 0.0, 0.0/)
2123 co470 = (/6.15825559, 3.47664076e-2, 1.9403065e-4, 0.0/)
2124 co650 = (/0.0, 0.0, 0.0, 0.0/)
2130 co412 = (/2.6482836, 4.0263797e-2, 0.0, 0.0/)
2131 co470 = (/7.06495618, 4.88471232e-2, -8.39825079e-5, 0.0/)
2132 co650 = (/0.0, 0.0, 0.0, 0.0/)
2141 co412 = (/2.97435558, 1.72237964e-02, 0.0, 0.0/)
2142 co470 = (/7.41527891, 5.88402071e-02, 7.96356631e-05, 0.0/)
2143 co650 = (/0.0, 0.0, 0.0, 0.0/)
2146 print *,
"ERROR: Invalid season specified: ", season
2152 case (
"Lecce_University")
2153 select case (season)
2155 co412 = (/3.66811317, 2.12308807e-02, 0.0, 0.0/)
2156 co470 = (/5.10650889, 7.12197835e-02, 6.15205093e-05, 0.0/)
2157 co650 = (/0.0, 0.0, 0.0, 0.0/)
2160 if (ndvi >= 0.45)
then
2161 co412 = (/3.42708429, 2.01945894e-02, 5.70725971e-04, 0.0/)
2162 co470 = (/4.23230444, 3.76471806e-02, 6.98131497e-04, 0.0/)
2163 co650 = (/0.0, 0.0, 0.0, 0.0/)
2164 else if (ndvi >= 0.40 .AND. ndvi < 0.45)
then
2165 co412 = (/4.82551344, 6.13242297e-03, 0.0, 0.0/)
2166 co470 = (/5.92910956, 5.63037114e-02, -9.05894219e-04, 0.0/)
2167 co650 = (/0.0, 0.0, 0.0, 0.0/)
2169 co412 = (/4.22986020, 2.78424337e-02, -1.44379581e-04, 0.0/)
2170 co470 = (/5.51855341, 6.20406750e-02, -2.63676847e-04, 0.0/)
2171 co650 = (/0.0, 0.0, 0.0, 0.0/)
2175 co412 = (/5.4920958, 4.2560058e-2, -3.3332266e-4, 0.0/)
2176 co470 = (/6.1583353, 6.8705510e-2, -2.7344898e-4, 0.0/)
2177 co650 = (/0.0, 0.0, 0.0, 0.0/)
2180 co412 = (/5.3015222, 3.2603717e-2, 4.9840706e-4, 0.0/)
2181 co470 = (/5.8268639, 5.6895741e-2, 4.2632621e-4, 0.0/)
2182 co650 = (/0.0, 0.0, 0.0, 0.0/)
2185 print *,
"ERROR: Invalid season specified: ", season
2192 select case (season)
2194 if (ndvi >= 0.36)
then
2195 co412 = (/3.63305224, 1.57411548e-2, 0.0, 0.0/)
2196 co470 = (/5.12339543, 3.27343565e-2, 0.0, 0.0/)
2197 co650 = (/0.0, 0.0, 0.0, 0.0/)
2199 co412 = (/4.14705645, 4.21266106e-2, 0.0, 0.0/)
2200 co470 = (/6.03776651, 6.0694725e-2, 0.0, 0.0/)
2201 co650 = (/0.0, 0.0, 0.0, 0.0/)
2210 if (ndvi < 0.3)
then
2211 co412 = (/5.31754912, 5.6181342e-2, 0.0, 0.0/)
2212 co470 = (/7.21956575, 8.6234168e-2, 0.0, 0.0/)
2213 co650 = (/0.0, 0.0, 0.0, 0.0/)
2214 else if (ndvi < 0.42)
then
2215 co412 = (/4.45713707, 2.95018243e-3, -9.6135173e-4, 4.91402021e-5/)
2216 co470 = (/5.88268514, 4.70497569e-2, 3.55853726e-5, 0.0/)
2217 co650 = (/0.0, 0.0, 0.0, 0.0/)
2219 co412 = (/3.48800908, 3.96286071e-2, 0.0, 0.0/)
2220 co470 = (/5.29642181, 4.57011215e-2, -6.90453319e-4, 3.20776151e-5/)
2221 co650 = (/0.0, 0.0, 0.0, 0.0/)
2244 if (ndvi < 0.42)
then
2245 co412 = (/3.3539774, 4.88920328e-2, -1.7442563e-3, 4.09605495e-5/)
2246 co470 = (/5.11861399, 6.21094378e-2, 0.0, 0.0/)
2247 co650 = (/0.0, 0.0, 0.0, 0.0/)
2249 co412 = (/2.94725072, 3.72651435e-2, 5.28386136e-4, 0.0/)
2250 co470 = (/4.75336791, 6.02706548e-2, -3.53602622e-4, 2.01191512e-5/)
2251 co650 = (/0.0, 0.0, 0.0, 0.0/)
2266 co412 = (/3.13735391, 3.48937426e-2, 3.64366638e-4, 0.0/)
2267 co470 = (/4.56241718, 5.2711995e-2, 9.26548766e-4, 0.0/)
2268 co650 = (/0.0, 0.0, 0.0, 0.0/)
2282 print *,
"ERROR: Invalid season specified: ", season
2288 select case (season)
2290 if (ndvi < 0.2)
then
2291 co412 = (/7.12231945, 4.85895624e-02, -1.28573607e-03, 2.25761306e-05/)
2292 co470 = (/9.29057722, 8.45987919e-02, -7.61137837e-04, 0.0/)
2293 co650 = (/0.0, 0.0, 0.0, 0.0/)
2295 co412 = (/6.67352731, 2.31096853e-02, -1.07985947e-03, 5.12622592e-05/)
2296 co470 = (/8.92322447, 7.99348838e-02, 0.0, 0.0/)
2297 co650 = (/0.0, 0.0, 0.0, 0.0/)
2300 if (ndvi < 0.18)
then
2301 co412 = (/6.79254216, 6.60335364e-02, 0.0, 0.0/)
2302 co470 = (/9.05448478, 1.01175023e-01, 1.31793002e-02, 0.0/)
2303 co650 = (/0.0, 0.0, 0.0, 0.0/)
2305 co412 = (/6.63306271, 4.20332840e-02, 1.87758245e-04, 0.0/)
2306 co470 = (/8.71407292, 7.83112414e-02, 1.01125671e-03, 0.0/)
2307 co650 = (/0.0, 0.0, 0.0, 0.0/)
2310 if (ndvi < 0.15)
then
2311 co412 = (/6.22897476, 0.0, 0.0, 0.0/)
2312 co470 = (/8.73022491, 0.0, 0.0, 0.0/)
2313 co650 = (/0.0, 0.0, 0.0, 0.0/)
2315 co412 = (/5.83693596, 2.94875730e-02, 4.27587428e-04, 0.0/)
2316 co470 = (/8.12482274, 5.32465081e-02, 0.0, 0.0/)
2317 co650 = (/0.0, 0.0, 0.0, 0.0/)
2320 if (ndvi < 0.2)
then
2321 co412 = (/9.20319079, 7.41965188e-02, -1.80650001e-04, 0.0/)
2322 co470 = (/6.17664662, 7.45518438e-02, -3.64408664e-04, -1.05957912e-05/)
2323 co650 = (/0.0, 0.0, 0.0, 0.0/)
2325 co412 = (/8.20920358, 5.96572455e-02, 7.20029748e-04, 1.07035450e-05/)
2326 co470 = (/6.35028669, 3.72669462e-02, 1.39396118e-04, 1.09315712e-05/)
2327 co650 = (/0.0, 0.0, 0.0, 0.0/)
2330 print *,
"ERROR: Invalid season specified: ", season
2336 select case (season)
2338 co412 = (/2.2107312, 1.9546884e-2, 1.0217331e-3, 0.0/)
2339 co470 = (/3.9707635, 4.5260501e-2, 8.2287074e-4, 0.0/)
2340 co650 = (/0.0, 0.0, 0.0, 0.0/)
2343 co412 = (/2.3410848, 1.1693201e-2, 9.9765075e-4, 0.0/)
2344 co470 = (/4.5157122, 5.7494184e-2, 2.3163434e-4, 0.0/)
2345 co650 = (/0.0, 0.0, 0.0, 0.0/)
2350 co412 = (/1.6509085, 3.2402477e-2, 1.5609563e-3, 0.0/)
2351 co470 = (/3.0505165, 4.3231390e-2, 1.4585233e-3, 0.0/)
2352 co650 = (/0.0, 0.0, 0.0, 0.0/)
2355 co412 = (/1.6509085, 3.2402477e-2, 1.5609563e-3, 0.0/)
2356 co470 = (/3.0505165, 4.3231390e-2, 1.4585233e-3, 0.0/)
2357 co650 = (/0.0, 0.0, 0.0, 0.0/)
2360 print *,
"ERROR: Invalid season specified: ", season
2367 select case (season)
2369 if (ndvi >= 0.54)
then
2370 co412 = (/1.8666770, 0.026571400, 0.0, 0.0/)
2371 co470 = (/3.24662224, 2.49647745e-02, 0.0, 0.0/)
2372 co650 = (/0.0, 0.0, 0.0, 0.0/)
2374 co412 = (/2.1474521, 0.019420845, 0.0, 0.0/)
2375 co470 = (/3.8045176, 0.038118250, 0.00044871309, 1.4730596e-05/)
2376 co650 = (/0.0, 0.0, 0.0, 0.0/)
2379 if (ndvi >= 0.54)
then
2380 co412 = (/2.67001676, -1.07772899e-02, 4.98010288e-04, -7.06071474e-06/)
2381 co470 = (/3.47056999, 1.75578420e-02, 1.07148973e-04, 7.60010333e-06/)
2382 co650 = (/0.0, 0.0, 0.0, 0.0/)
2383 else if (ndvi >= 0.42)
then
2384 co412 = (/3.57946117, -2.10298778e-02, -4.11579021e-04, 1.55923969e-05/)
2385 co470 = (/4.34427890, 1.57998603e-02, -5.70677301e-04, 2.11628341e-05/)
2386 co650 = (/0.0, 0.0, 0.0, 0.0/)
2388 co412 = (/3.49153138, -1.82641547e-02, 1.71132131e-03, -2.49950954e-05/)
2389 co470 = (/4.24504494, 4.49089153e-02, 1.81406770e-03, -3.88986042e-05/)
2390 co650 = (/0.0, 0.0, 0.0, 0.0/)
2393 if (ndvi >= 0.36)
then
2394 co412 = (/3.51804408, -5.43557298e-03, -4.11664584e-05, 4.19463147e-06/)
2395 co470 = (/4.42020622, 3.56782224e-02, 2.32453523e-04, 0.0/)
2396 co650 = (/0.0, 0.0, 0.0, 0.0/)
2397 else if (ndvi >= 0.32)
then
2398 co412 = (/4.02658655, -3.41714839e-02, 1.49532934e-03, -1.20524324e-05/)
2399 co470 = (/5.29484758, 3.27714291e-02, 0.0, 0.0/)
2400 co650 = (/0.0, 0.0, 0.0, 0.0/)
2401 else if (ndvi >= 0.27)
then
2402 co412 = (/4.29981928, -1.11379081e-02, 1.05046171e-03, -1.30375107e-05/)
2403 co470 = (/5.64253900, 3.74786248e-02, 5.83243337e-04, -1.00991872e-05/)
2404 co650 = (/0.0, 0.0, 0.0, 0.0/)
2406 co412 = (/4.86874172, 2.25252861e-02, 1.87141545e-04, 0.0/)
2407 co470 = (/6.16672976, 5.10490840e-02, 9.10921618e-05, 0.0/)
2408 co650 = (/0.0, 0.0, 0.0, 0.0/)
2411 if (ndvi >= 0.47)
then
2412 co412 = (/1.58754835, 1.20745361e-02, 0.0, 0.0/)
2413 co470 = (/2.98246568, 9.57936578e-03, 0.0, 0.0/)
2414 co650 = (/0.0, 0.0, 0.0, 0.0/)
2415 else if (ndvi >= 0.36)
then
2416 co412 = (/2.94407598, 1.56448599e-02, 0.0, 0.0/)
2417 co470 = (/4.64143550, 3.94157958e-02, 5.30955969e-05, 0.0/)
2418 co650 = (/0.0, 0.0, 0.0, 0.0/)
2419 else if (ndvi >= 0.27)
then
2420 co412 = (/3.55241655, 1.07045809e-02, 4.82439668e-04, 0.0/)
2421 co470 = (/5.21955006, 5.10611495e-02, 6.06966186e-04, 0.0/)
2422 co650 = (/0.0, 0.0, 0.0, 0.0/)
2424 co412 = (/4.93773812, -6.30823250e-04, 4.83307917e-04, 0.0/)
2425 co470 = (/6.54996856, 3.14618262e-02, 2.51836348e-04, 0.0/)
2426 co650 = (/0.0, 0.0, 0.0, 0.0/)
2429 print *,
"ERROR: Invalid season specified: ", season
2435 select case (season)
2437 if (ndvi >= 0.54)
then
2438 co412 = (/1.8666770, 0.026571400, 0.0, 0.0/)
2439 co470 = (/3.24662224, 2.49647745e-02, 0.0, 0.0/)
2440 co650 = (/0.0, 0.0, 0.0, 0.0/)
2442 co412 = (/2.1474521, 0.019420845, 0.0, 0.0/)
2443 co470 = (/3.8045176, 0.038118250, 0.00044871309, 1.4730596e-05/)
2444 co650 = (/0.0, 0.0, 0.0, 0.0/)
2447 if (ndvi >= 0.54)
then
2448 co412 = (/2.67001676, -1.07772899e-02, 4.98010288e-04, -7.06071474e-06/)
2449 co470 = (/3.47056999, 1.75578420e-02, 1.07148973e-04, 7.60010333e-06/)
2450 co650 = (/0.0, 0.0, 0.0, 0.0/)
2451 else if (ndvi >= 0.42)
then
2452 co412 = (/3.57946117, -2.10298778e-02, -4.11579021e-04, 1.55923969e-05/)
2453 co470 = (/4.34427890, 1.57998603e-02, -5.70677301e-04, 2.11628341e-05/)
2454 co650 = (/0.0, 0.0, 0.0, 0.0/)
2456 co412 = (/3.49153138, -1.82641547e-02, 1.71132131e-03, -2.49950954e-05/)
2457 co470 = (/4.24504494, 4.49089153e-02, 1.81406770e-03, -3.88986042e-05/)
2458 co650 = (/0.0, 0.0, 0.0, 0.0/)
2461 if (ndvi >= 0.36)
then
2462 co412 = (/3.51804408, -5.43557298e-03, -4.11664584e-05, 4.19463147e-06/)
2463 co470 = (/4.42020622, 3.56782224e-02, 2.32453523e-04, 0.0/)
2464 co650 = (/0.0, 0.0, 0.0, 0.0/)
2465 else if (ndvi >= 0.32)
then
2466 co412 = (/4.02658655, -3.41714839e-02, 1.49532934e-03, -1.20524324e-05/)
2467 co470 = (/5.29484758, 3.27714291e-02, 0.0, 0.0/)
2468 co650 = (/0.0, 0.0, 0.0, 0.0/)
2469 else if (ndvi >= 0.27)
then
2470 co412 = (/4.29981928, -1.11379081e-02, 1.05046171e-03, -1.30375107e-05/)
2471 co470 = (/5.64253900, 3.74786248e-02, 5.83243337e-04, -1.00991872e-05/)
2472 co650 = (/0.0, 0.0, 0.0, 0.0/)
2474 co412 = (/4.48791268, 2.86111924e-02, 0.0, 0.0/)
2475 co470 = (/6.24638193, 6.48367744e-02, -1.46322122e-03, 2.77197095e-05/)
2476 co650 = (/0.0, 0.0, 0.0, 0.0/)
2479 if (ndvi >= 0.47)
then
2480 co412 = (/1.58754835, 1.20745361e-02, 0.0, 0.0/)
2481 co470 = (/2.98246568, 9.57936578e-03, 0.0, 0.0/)
2482 co650 = (/0.0, 0.0, 0.0, 0.0/)
2483 else if (ndvi >= 0.36)
then
2484 co412 = (/2.94407598, 1.56448599e-02, 0.0, 0.0/)
2485 co470 = (/4.64143550, 3.94157958e-02, 5.30955969e-05, 0.0/)
2486 co650 = (/0.0, 0.0, 0.0, 0.0/)
2487 else if (ndvi >= 0.27)
then
2488 co412 = (/3.55241655, 1.07045809e-02, 4.82439668e-04, 0.0/)
2489 co470 = (/5.21955006, 5.10611495e-02, 6.06966186e-04, 0.0/)
2490 co650 = (/0.0, 0.0, 0.0, 0.0/)
2492 co412 = (/4.93773812, -6.30823250e-04, 4.83307917e-04, 0.0/)
2493 co470 = (/6.54996856, 3.14618262e-02, 2.51836348e-04, 0.0/)
2494 co650 = (/0.0, 0.0, 0.0, 0.0/)
2497 print *,
"ERROR: Invalid season specified: ", season
2504 select case (season)
2506 if (ndvi >= 0.42)
then
2507 co412 = (/1.32086397, 9.43028773e-03, 6.22359822e-04, 0.0/)
2508 co470 = (/2.85239261, 3.20907415e-02, 8.29035330e-04, 0.0/)
2509 co650 = (/0.0, 0.0, 0.0, 0.0/)
2511 co412 = (/1.36446568, 0.0, 0.0, 0.0/)
2512 co470 = (/2.92020512, -1.43458296e-02, -1.39739540e-03, 3.21024412e-05/)
2513 co650 = (/0.0, 0.0, 0.0, 0.0/)
2519 co412 = (/2.29853905, 8.40506270e-03, 4.88300278e-04, 0.0/)
2520 co470 = (/3.44064029, 3.21979141e-02, -4.24620655e-04, 2.12964306e-05/)
2521 co650 = (/0.0, 0.0, 0.0, 0.0/)
2532 if (ndvi >= 0.36)
then
2533 co412 = (/3.51804408, -5.43557298e-03, -4.11664584e-05, 4.19463147e-06/)
2534 co470 = (/4.42020622, 3.56782224e-02, 2.32453523e-04, 0.0/)
2535 co650 = (/0.0, 0.0, 0.0, 0.0/)
2536 else if (ndvi >= 0.30)
then
2537 co412 = (/4.02658655, -3.41714839e-02, 1.49532934e-03, -1.20524324e-05/)
2538 co470 = (/5.29484758, 3.27714291e-02, 0.0, 0.0/)
2539 co650 = (/0.0, 0.0, 0.0, 0.0/)
2541 co412 = (/4.29981928, -1.11379081e-02, 1.05046171e-03, -1.30375107e-05/)
2542 co470 = (/5.64253900, 3.74786248e-02, 5.83243337e-04, -1.00991872e-05/)
2543 co650 = (/0.0, 0.0, 0.0, 0.0/)
2555 if (ndvi >= 0.36)
then
2556 co412 = (/1.31986294, -1.07513582e-02, 4.65319050e-04, 2.35774710e-05/)
2557 co470 = (/3.03892353, 2.84719270e-02, 4.80364309e-04, 2.19066757e-05/)
2558 co650 = (/0.0, 0.0, 0.0, 0.0/)
2560 co412 = (/2.18453166, 3.51533148e-02, 0.0, 0.0/)
2561 co470 = (/3.68111291, 5.65877577e-02, 0.0, 0.0/)
2562 co650 = (/0.0, 0.0, 0.0, 0.0/)
2574 print *,
"ERROR: Invalid season specified: ", season
2580 select case (season)
2582 if (ndvi >= 0.42)
then
2583 co412 = (/1.32086397, 9.43028773e-03, 6.22359822e-04, 0.0/)
2584 co470 = (/2.85239261, 3.20907415e-02, 8.29035330e-04, 0.0/)
2585 co650 = (/0.0, 0.0, 0.0, 0.0/)
2587 co412 = (/1.36446568, 0.0, 0.0, 0.0/)
2588 co470 = (/2.92020512, -1.43458296e-02, -1.39739540e-03, 3.21024412e-05/)
2589 co650 = (/0.0, 0.0, 0.0, 0.0/)
2595 co412 = (/2.29853905, 8.40506270e-03, 4.88300278e-04, 0.0/)
2596 co470 = (/3.44064029, 3.21979141e-02, -4.24620655e-04, 2.12964306e-05/)
2597 co650 = (/0.0, 0.0, 0.0, 0.0/)
2608 if (ndvi >= 0.36)
then
2609 co412 = (/3.51804408, -5.43557298e-03, -4.11664584e-05, 4.19463147e-06/)
2610 co470 = (/4.42020622, 3.56782224e-02, 2.32453523e-04, 0.0/)
2611 co650 = (/0.0, 0.0, 0.0, 0.0/)
2612 else if (ndvi >= 0.30)
then
2613 co412 = (/4.02658655, -3.41714839e-02, 1.49532934e-03, -1.20524324e-05/)
2614 co470 = (/5.29484758, 3.27714291e-02, 0.0, 0.0/)
2615 co650 = (/0.0, 0.0, 0.0, 0.0/)
2617 co412 = (/4.29981928, -1.11379081e-02, 1.05046171e-03, -1.30375107e-05/)
2618 co470 = (/5.64253900, 3.74786248e-02, 5.83243337e-04, -1.00991872e-05/)
2619 co650 = (/0.0, 0.0, 0.0, 0.0/)
2631 if (ndvi >= 0.36)
then
2632 co412 = (/1.31986294, -1.07513582e-02, 4.65319050e-04, 2.35774710e-05/)
2633 co470 = (/3.03892353, 2.84719270e-02, 4.80364309e-04, 2.19066757e-05/)
2634 co650 = (/0.0, 0.0, 0.0, 0.0/)
2636 co412 = (/2.18453166, 3.51533148e-02, 0.0, 0.0/)
2637 co470 = (/3.68111291, 5.65877577e-02, 0.0, 0.0/)
2638 co650 = (/0.0, 0.0, 0.0, 0.0/)
2650 print *,
"ERROR: Invalid season specified: ", season
2657 select case (season)
2659 if (ndvi >= 0.42)
then
2660 co412 = (/1.32086397, 9.43028773e-03, 6.22359822e-04, 0.0/)
2661 co470 = (/2.85239261, 3.20907415e-02, 8.29035330e-04, 0.0/)
2662 co650 = (/0.0, 0.0, 0.0, 0.0/)
2664 co412 = (/1.36446568, 0.0, 0.0, 0.0/)
2665 co470 = (/2.92020512, -1.43458296e-02, -1.39739540e-03, 3.21024412e-05/)
2666 co650 = (/0.0, 0.0, 0.0, 0.0/)
2672 co412 = (/2.29853905, 8.40506270e-03, 4.88300278e-04, 0.0/)
2673 co470 = (/3.44064029, 3.21979141e-02, -4.24620655e-04, 2.12964306e-05/)
2674 co650 = (/0.0, 0.0, 0.0, 0.0/)
2685 if (ndvi >= 0.36)
then
2686 co412 = (/3.51804408, -5.43557298e-03, -4.11664584e-05, 4.19463147e-06/)
2687 co470 = (/4.42020622, 3.56782224e-02, 2.32453523e-04, 0.0/)
2688 co650 = (/0.0, 0.0, 0.0, 0.0/)
2689 else if (ndvi >= 0.30)
then
2690 co412 = (/4.02658655, -3.41714839e-02, 1.49532934e-03, -1.20524324e-05/)
2691 co470 = (/5.29484758, 3.27714291e-02, 0.0, 0.0/)
2692 co650 = (/0.0, 0.0, 0.0, 0.0/)
2694 co412 = (/4.29981928, -1.11379081e-02, 1.05046171e-03, -1.30375107e-05/)
2695 co470 = (/5.64253900, 3.74786248e-02, 5.83243337e-04, -1.00991872e-05/)
2696 co650 = (/0.0, 0.0, 0.0, 0.0/)
2708 if (ndvi >= 0.36)
then
2709 co412 = (/1.31986294, -1.07513582e-02, 4.65319050e-04, 2.35774710e-05/)
2710 co470 = (/3.03892353, 2.84719270e-02, 4.80364309e-04, 2.19066757e-05/)
2711 co650 = (/0.0, 0.0, 0.0, 0.0/)
2713 co412 = (/2.18453166, 3.51533148e-02, 0.0, 0.0/)
2714 co470 = (/3.68111291, 5.65877577e-02, 0.0, 0.0/)
2715 co650 = (/0.0, 0.0, 0.0, 0.0/)
2727 print *,
"ERROR: Invalid season specified: ", season
2733 select case (season)
2735 if (ndvi >= 0.42)
then
2736 co412 = (/1.32086397, 9.43028773e-03, 6.22359822e-04, 0.0/)
2737 co470 = (/2.85239261, 3.20907415e-02, 8.29035330e-04, 0.0/)
2738 co650 = (/0.0, 0.0, 0.0, 0.0/)
2740 co412 = (/1.36446568, 0.0, 0.0, 0.0/)
2741 co470 = (/2.92020512, -1.43458296e-02, -1.39739540e-03, 3.21024412e-05/)
2742 co650 = (/0.0, 0.0, 0.0, 0.0/)
2748 co412 = (/2.29853905, 8.40506270e-03, 4.88300278e-04, 0.0/)
2749 co470 = (/3.44064029, 3.21979141e-02, -4.24620655e-04, 2.12964306e-05/)
2750 co650 = (/0.0, 0.0, 0.0, 0.0/)
2761 if (ndvi >= 0.36)
then
2762 co412 = (/3.51804408, -5.43557298e-03, -4.11664584e-05, 4.19463147e-06/)
2763 co470 = (/4.42020622, 3.56782224e-02, 2.32453523e-04, 0.0/)
2764 co650 = (/0.0, 0.0, 0.0, 0.0/)
2765 else if (ndvi >= 0.30)
then
2766 co412 = (/4.02658655, -3.41714839e-02, 1.49532934e-03, -1.20524324e-05/)
2767 co470 = (/5.29484758, 3.27714291e-02, 0.0, 0.0/)
2768 co650 = (/0.0, 0.0, 0.0, 0.0/)
2770 co412 = (/4.29981928, -1.11379081e-02, 1.05046171e-03, -1.30375107e-05/)
2771 co470 = (/5.64253900, 3.74786248e-02, 5.83243337e-04, -1.00991872e-05/)
2772 co650 = (/0.0, 0.0, 0.0, 0.0/)
2784 if (ndvi >= 0.36)
then
2785 co412 = (/1.31986294, -1.07513582e-02, 4.65319050e-04, 2.35774710e-05/)
2786 co470 = (/3.03892353, 2.84719270e-02, 4.80364309e-04, 2.19066757e-05/)
2787 co650 = (/0.0, 0.0, 0.0, 0.0/)
2789 co412 = (/2.18453166, 3.51533148e-02, 0.0, 0.0/)
2790 co470 = (/3.68111291, 5.65877577e-02, 0.0, 0.0/)
2791 co650 = (/0.0, 0.0, 0.0, 0.0/)
2803 print *,
"ERROR: Invalid season specified: ", season
2809 select case (season)
2812 co412 = (/1.95397318, 1.73386252e-02, -3.19877587e-04, 4.02574564e-06/)
2813 co470 = (/2.76241404, 5.21461588e-02, -4.94776417e-04, 5.45084985e-06/)
2814 co650 = (/0.0, 0.0, 0.0, 0.0/)
2825 co412 = (/1.95397318, 1.73386252e-02, -3.19877587e-04, 4.02574564e-06/)
2826 co470 = (/2.76241404, 5.21461588e-02, -4.94776417e-04, 5.45084985e-06/)
2827 co650 = (/0.0, 0.0, 0.0, 0.0/)
2838 co412 = (/1.95397318, 1.73386252e-02, -3.19877587e-04, 4.02574564e-06/)
2839 co470 = (/2.76241404, 5.21461588e-02, -4.94776417e-04, 5.45084985e-06/)
2840 co650 = (/0.0, 0.0, 0.0, 0.0/)
2851 co412 = (/1.95397318, 1.73386252e-02, -3.19877587e-04, 4.02574564e-06/)
2852 co470 = (/2.76241404, 5.21461588e-02, -4.94776417e-04, 5.45084985e-06/)
2853 co650 = (/0.0, 0.0, 0.0, 0.0/)
2860 print *,
"ERROR: Invalid season specified: ", season
2864 case (
"Ilorin_Transition")
2865 select case (season)
2868 co412 = (/1.95397318, 1.73386252e-02, -3.19877587e-04, 4.02574564e-06/)
2869 co470 = (/2.76241404, 5.21461588e-02, -4.94776417e-04, 5.45084985e-06/)
2870 co650 = (/0.0, 0.0, 0.0, 0.0/)
2881 co412 = (/1.95397318, 1.73386252e-02, -3.19877587e-04, 4.02574564e-06/)
2882 co470 = (/2.76241404, 5.21461588e-02, -4.94776417e-04, 5.45084985e-06/)
2883 co650 = (/0.0, 0.0, 0.0, 0.0/)
2894 co412 = (/1.95397318, 1.73386252e-02, -3.19877587e-04, 4.02574564e-06/)
2895 co470 = (/2.76241404, 5.21461588e-02, -4.94776417e-04, 5.45084985e-06/)
2896 co650 = (/0.0, 0.0, 0.0, 0.0/)
2907 co412 = (/1.95397318, 1.73386252e-02, -3.19877587e-04, 4.02574564e-06/)
2908 co470 = (/2.76241404, 5.21461588e-02, -4.94776417e-04, 5.45084985e-06/)
2909 co650 = (/0.0, 0.0, 0.0, 0.0/)
2916 print *,
"ERROR: Invalid season specified: ", season
2922 select case (season)
2924 co412 = (/1.42564317, 0.0, 0.0, 0.0/)
2925 co470 = (/5.32085036, 7.76166789e-02, 0.0, 0.0/)
2926 co650 = (/0.0, 0.0, 0.0, 0.0/)
2928 if (ndvi < 0.22)
then
2929 co412 = (/2.56745262, 3.14455912e-02, 0.0, 0.0/)
2930 co470 = (/5.72543787, 6.57833956e-02, 0.0, 0.0/)
2931 co650 = (/0.0, 0.0, 0.0, 0.0/)
2933 co412 = (/2.98578012, 9.14981794e-03, 2.78390281e-05, 0.0/)
2934 co470 = (/5.35045898, 5.95767492e-02, -2.40088902e-04, 0.0/)
2935 co650 = (/0.0, 0.0, 0.0, 0.0/)
2938 if (ndvi < 0.32)
then
2939 co412 = (/3.09389618, 3.43945319e-02, -1.73503979e-04, 0.0/)
2940 co470 = (/5.26831030, 7.26053989e-02, -4.36121233e-04, 0.0/)
2941 co650 = (/0.0, 0.0, 0.0, 0.0/)
2942 else if (ndvi >= 0.32 .AND. ndvi < 0.38)
then
2943 co412 = (/2.29526550, -2.85560957e-02, 1.16556608e-03, 0.0/)
2944 co470 = (/4.35768768, 2.04838826e-02, 7.12226936e-04, 0.0/)
2945 co650 = (/0.0, 0.0, 0.0, 0.0/)
2947 co412 = (/2.57989638, 3.85962492e-02, -1.23228526e-03, 0.0/)
2948 co470 = (/4.19697042, 6.43432125e-02, -1.15802337e-03, 0.0/)
2949 co650 = (/0.0, 0.0, 0.0, 0.0/)
2952 if (ndvi < 0.20)
then
2953 co412 = (/7.26239004e-01, 1.6566520e-02, 0.0, 0.0/)
2954 co470 = (/5.08897915, 2.07599476e-02, -1.86393057e-03, 2.40076652e-05/)
2955 co650 = (/0.0, 0.0, 0.0, 0.0/)
2956 else if (ndvi >= 0.2 .AND. ndvi < 0.3)
then
2957 co412 = (/1.45776255, 7.95302789e-03, 0.0, 0.0/)
2958 co470 = (/4.23968258, 4.32695605e-02, 0.0, 0.0/)
2959 co650 = (/0.0, 0.0, 0.0, 0.0/)
2961 co412 = (/1.01734497, 0.0, 0.0, 0.0/)
2962 co470 = (/3.58458577, 4.92096024e-02, -1.69568606e-04, 0.0/)
2963 co650 = (/0.0, 0.0, 0.0, 0.0/)
2966 print *,
"ERROR: Invalid season specified: ", season
2971 case (
"Mexico_City")
2972 select case (season)
2974 co412 = (/1.5925121, 3.3497126e-3, 5.2599315e-4, 0.0/)
2975 co470 = (/5.1297925, 2.8796298e-2, 1.3826814e-3, 0.0/)
2976 co650 = (/0.0, 0.0, 0.0, 0.0/)
2979 co412 = (/2.0907425, -9.7213367e-3, 5.6728594e-4, 0.0/)
2980 co470 = (/5.4475574, 4.8689334e-2, 1.3585394e-4, 0.0/)
2981 co650 = (/0.0, 0.0, 0.0, 0.0/)
2984 if (ndvi < 0.2)
then
2985 co412 = (/1.31131496, 1.90175933e-02, 0.0, 0.0/)
2986 co470 = (/4.28780511, 4.85799304e-02, 1.65298184e-03, 0.0/)
2987 co650 = (/0.0, 0.0, 0.0, 0.0/)
2989 co412 = (/3.19067520, 2.81951590e-02, 0.0, 0.0/)
2990 co470 = (/3.14833814, 1.05654939e-01, 0.0, 0.0/)
2991 co650 = (/0.0, 0.0, 0.0, 0.0/)
2995 co412 = (/1.8093284, -9.0862879e-4, 2.2399699e-4, 0.0/)
2996 co470 = (/5.1765348, 3.8358608e-2, 9.4711253e-4, 0.0/)
2997 co650 = (/0.0, 0.0, 0.0, 0.0/)
3000 print *,
"ERROR: Invalid season specified: ", season
3006 select case (season)
3008 if (ndvi < 0.2)
then
3009 co412 = (/3.96991225, 5.96628950e-02, 2.13615454e-04, 0.0/)
3010 co470 = (/6.99850585, 8.36445599e-02, -1.10860486e-04, 6.74081297e-06/)
3011 co650 = (/0.0, 0.0, 0.0, 0.0/)
3012 else if (ndvi < 0.25)
then
3013 co412 = (/3.833049805, 4.78326202e-02, -6.22253363e-04, 0.0/)
3014 co470 = (/6.31127139, 6.19777232e-02, -1.56997452e-04, 2.82474197e-05/)
3015 co650 = (/0.0, 0.0, 0.0, 0.0/)
3017 co412 = (/4.66180293, 2.20314064e-02, 5.87633091e-04, -4.13864227e-06/)
3018 co470 = (/6.57270431, 5.7747869e-02, 7.34838329e-06, 0.0/)
3019 co650 = (/0.0, 0.0, 0.0, 0.0/)
3023 if (ndvi < 0.18)
then
3024 co412 = (/4.20196229, 5.29500002e-02, 3.20204802e-04, 0.0/)
3025 co470 = (/7.22026945, 9.03690963e-02, 0.0, 0.0/)
3026 co650 = (/0.0, 0.0, 0.0, 0.0/)
3028 co412 = (/4.65595362, 7.51832486e-02, -1.85215442e-03, 2.82980108e-05/)
3029 co470 = (/7.06658854, 8.85016889e-02, -8.29003477e-04, 1.30125894e-05/)
3030 co650 = (/0.0, 0.0, 0.0, 0.0/)
3033 if (ndvi < 0.2)
then
3034 co412 = (/4.28651135, 9.9311289e-02, -5.34064043e-04, 0.0/)
3035 co470 = (/7.49201557, 1.37003165e-01, -1.41178674e-03, 8.95252657e-06/)
3036 co650 = (/0.0, 0.0, 0.0, 0.0/)
3038 co412 = (/7.02860038, -4.65828642e-03, 0.0, 0.0/)
3039 co470 = (/7.89866675, 2.63625768e-02, 0.0, 0.0/)
3040 co650 = (/0.0, 0.0, 0.0, 0.0/)
3044 if (ndvi < 0.22)
then
3045 co412 = (/2.82799186, 3.51207193e-02, 0.0, 0.0/)
3046 co470 = (/6.03474644, 6.89646847e-02, 3.96325172e-04, 0.0/)
3047 co650 = (/0.0, 0.0, 0.0, 0.0/)
3048 else if (ndvi < 0.25)
then
3049 co412 = (/3.52929901, 5.18358835e-02, 0.0, 0.0/)
3050 co470 = (/5.94045545, 7.50816643e-02, 6.01703567e-04, -4.63811122e-06/)
3051 co650 = (/0.0, 0.0, 0.0, 0.0/)
3053 co412 = (/4.70013291, 2.23865261e-02, -2.10276745e-05, 1.11426756e-05/)
3054 co470 = (/6.46922757, 3.76858031e-02, 7.48824729e-04, 0.0/)
3055 co650 = (/0.0, 0.0, 0.0, 0.0/)
3058 print *,
"ERROR: Invalid season specified: ", season
3063 case (
"NW_India_Desert")
3064 select case (season)
3066 if (ndvi < 0.2)
then
3067 co412 = (/3.96991225, 5.96628950e-02, 2.13615454e-04, 0.0/)
3068 co470 = (/6.99850585, 8.36445599e-02, -1.10860486e-04, 6.74081297e-06/)
3069 co650 = (/0.0, 0.0, 0.0, 0.0/)
3070 else if (ndvi < 0.25)
then
3071 co412 = (/3.833049805, 4.78326202e-02, -6.22253363e-04, 0.0/)
3072 co470 = (/6.31127139, 6.19777232e-02, -1.56997452e-04, 2.82474197e-05/)
3073 co650 = (/0.0, 0.0, 0.0, 0.0/)
3075 co412 = (/4.66180293, 2.20314064e-02, 5.87633091e-04, -4.13864227e-06/)
3076 co470 = (/6.57270431, 5.7747869e-02, 7.34838329e-06, 0.0/)
3077 co650 = (/0.0, 0.0, 0.0, 0.0/)
3081 if (ndvi < 0.18)
then
3082 co412 = (/4.20196229, 5.29500002e-02, 3.20204802e-04, 0.0/)
3083 co470 = (/7.22026945, 9.03690963e-02, 0.0, 0.0/)
3084 co650 = (/0.0, 0.0, 0.0, 0.0/)
3086 co412 = (/4.65595362, 7.51832486e-02, -1.85215442e-03, 2.82980108e-05/)
3087 co470 = (/7.06658854, 8.85016889e-02, -8.29003477e-04, 1.30125894e-05/)
3088 co650 = (/0.0, 0.0, 0.0, 0.0/)
3091 if (ndvi < 0.2)
then
3092 co412 = (/4.28651135, 9.9311289e-02, -5.34064043e-04, 0.0/)
3093 co470 = (/7.49201557, 1.37003165e-01, -1.41178674e-03, 8.95252657e-06/)
3094 co650 = (/0.0, 0.0, 0.0, 0.0/)
3096 co412 = (/7.02860038, -4.65828642e-03, 0.0, 0.0/)
3097 co470 = (/7.89866675, 2.63625768e-02, 0.0, 0.0/)
3098 co650 = (/0.0, 0.0, 0.0, 0.0/)
3102 if (ndvi < 0.22)
then
3103 co412 = (/2.82799186, 3.51207193e-02, 0.0, 0.0/)
3104 co470 = (/6.03474644, 6.89646847e-02, 3.96325172e-04, 0.0/)
3105 co650 = (/0.0, 0.0, 0.0, 0.0/)
3106 else if (ndvi < 0.25)
then
3107 co412 = (/3.52929901, 5.18358835e-02, 0.0, 0.0/)
3108 co470 = (/5.94045545, 7.50816643e-02, 6.01703567e-04, -4.63811122e-06/)
3109 co650 = (/0.0, 0.0, 0.0, 0.0/)
3111 co412 = (/4.70013291, 2.23865261e-02, -2.10276745e-05, 1.11426756e-05/)
3112 co470 = (/6.46922757, 3.76858031e-02, 7.48824729e-04, 0.0/)
3113 co650 = (/0.0, 0.0, 0.0, 0.0/)
3116 print *,
"ERROR: Invalid season specified: ", season
3121 case (
"Solar_Village")
3122 select case (season)
3124 co412 = (/9.57450477, 6.14694128e-02, 0.0, 0.0/)
3125 if (vza < 20.0)
then
3126 co470 = (/1.60353001e01, 1.10436421e-02, 7.06173197e-04, 0.0/)
3127 else if (vza < 50.0)
then
3128 co470 = (/1.50683392e01, 9.11896309e-02, 8.77940132e-04, -2.02723278e-05/)
3130 co470 = (/1.58007075e01, 1.11295620e-01, 0.0, 0.0/)
3132 co650 = (/0.0, 0.0, 0.0, 0.0/)
3135 co412 = (/8.74736445, 6.51554815e-02, 0.0, 0.0/)
3136 co470 = (/1.53111360e01, 1.05595037e-01, -7.31500339e-04, 0.0/)
3137 co650 = (/0.0, 0.0, 0.0, 0.0/)
3139 if (raa < 50.0)
then
3140 co412 = (/8.63300701, 1.29057864e-01, -2.95916295e-03, 1.83110100e-05/)
3141 co470 = (/1.46695788e01, 9.60421930e-02, -2.40220378e-03, 2.99138049e-05/)
3142 co650 = (/0.0, 0.0, 0.0, 0.0/)
3143 else if (raa >= 50.0 .AND. raa < 90.0)
then
3144 co412 = (/1.01609630e01, 1.02434047e-01, -1.36452416e-03, 0.0/)
3145 co470 = (/1.51255831e01, 7.36233156e-02, 4.74327855e-04, 0.0/)
3146 co650 = (/0.0, 0.0, 0.0, 0.0/)
3147 else if (raa >= 90.0 .AND. raa < 160.0)
then
3148 co412 = (/1.09242704e01, 0.0, 0.0, 0.0/)
3149 co470 = (/1.95602923e01, -5.44866657e-02, 0.0, 0.0/)
3150 co650 = (/0.0, 0.0, 0.0, 0.0/)
3152 co412 = (/7.76882726, 7.90204491e-02, 0.0, 0.0/)
3153 co470 = (/1.65201198e01, 3.67393757e-02, 0.0, 0.0/)
3154 co650 = (/0.0, 0.0, 0.0, 0.0/)
3158 co412 = (/9.22657792, 5.53831366e-02, 0.0, 0.0/)
3159 if (vza < 25.0)
then
3160 co470 = (/1.39265362e01, 9.32481786e-02, 0.0, 0.0/)
3161 else if (vza < 45.0)
then
3162 co470 = (/1.47453243e01, 9.60301995e-02, 0.0, 0.0/)
3164 co470 = (/1.54562369e01, 9.40036429e-02, 0.0, 0.0/)
3167 co412 = (/8.9590389, 0.017604729, 0.00076547611, -2.1966118e-06/)
3168 co470 = (/14.904570, 0.053656442, 0.0010690852, -1.8405743e-05/)
3169 co650 = (/0.0, 0.0, 0.0, 0.0/)
3171 if (raa < 90.0)
then
3172 co412 = (/9.1177595, 0.039785655, -0.00062878201, 2.1237891e-05/)
3173 co470 = (/14.843738, 0.024588279, 0.00021114164, 1.2466120e-05/)
3174 co650 = (/0.0, 0.0, 0.0, 0.0/)
3176 co412 = (/7.55891171, 8.05857229e-02, 0.0, 0.0/)
3177 co470 = (/1.66963898e01, 1.07268522e-02, 2.79875503e-04, 0.0/)
3178 co650 = (/0.0, 0.0, 0.0, 0.0/)
3181 co412 = (/9.81027873, 5.79203714e-02, 0.0, 0.0/)
3182 if (vza < 25.0)
then
3183 co470 = (/1.50017355e01, 8.33530298e-02, 0.0, 0.0/)
3184 else if (vza < 50.0)
then
3185 co470 = (/1.54093325e01, 9.33699483e-02, -8.75858189e-05, 1.76518228e-05/)
3187 co470 = (/1.63141003e10, 1.14528713e-01, 0.0, 0.0/)
3191 print *,
"ERROR: Invalid season specified: ", season
3197 select case (season)
3199 co412 = (/8.88808, 4.0613965e-2, 1.1960322e-3, 0.0/)
3200 co470 = (/10.78728, 6.864285e-2, 1.15425508e-3, 0.0/)
3201 co650 = (/0.0, 0.0, 0.0, 0.0/)
3204 co412 = (/8.7442283, 2.53485488e-2, 4.54854215e-4,0.0/)
3205 co470 = (/10.872899, 5.6826757e-2, 1.35925198e-4, 0.0/)
3206 co650 = (/0.0, 0.0, 0.0, 0.0/)
3209 co412 = (/8.7692651, 3.3495399e-2, 3.7264769e-4,0.0/)
3210 co470 = (/10.92206559, 5.96282369e-2, 2.79797715e-4, 0.0/)
3211 co650 = (/0.0, 0.0, 0.0, 0.0/)
3214 co412 = (/8.9693997, 3.65029508e-2, 6.62722818e-4,0.0/)
3215 co470 = (/11.0841727, 5.91805818e-2, 7.60347456e-4, 0.0/)
3216 co650 = (/0.0, 0.0, 0.0, 0.0/)
3219 print *,
"ERROR: Invalid season specified: ", season
3225 print *,
"ERROR: Invalid AERONET site specified. No BRDF values."
3231 s412 = co412(1) + co412(2)*(sca-120.0) + co412(3)*((sca-120.0)**2) + co412(4)*((sca-120.0)**3)
3232 s470 = co470(1) + co470(2)*(sca-120.0) + co470(3)*((sca-120.0)**2) + co470(4)*((sca-120.0)**3)
3233 s650 = co650(1) + co650(2)*(sca-120.0) + co650(3)*((sca-120.0)**2) + co650(4)*((sca-120.0)**3)
3240 print
'(A,A,A,I4,I4,2(F11.6,1X))',
trim(func_name),
", site, month, season, ndvi, scat: ", &
3241 & aero_site, month, season, ndvi, sca
3242 print
'(A,A,4(F11.6,1X))',
trim(func_name),
", BRDF coeffs412: ", co412
3243 print
'(A,A,4(F11.6,1X))',
trim(func_name),
", BRDF coeffs470: ", co470
3244 print
'(A,A,4(F11.6,1X))',
trim(func_name),
", BRDF coeffs650: ", co650
3245 print
'(A,A,3(F11.6,1x))',
trim(func_name),
", BRDF SR, 412, s470, s650: ", s412, s470, s650
3251 end function get_aeronet_brdf_sr
3255 real function
get_aot500(lat, lon, elev, sa, season, ndvi, gzone, lc_type, stdv02, &
3256 & aot412_91, aot412_93, aot412_94, aot412_96, aot412_995, &
3257 & aot470_91, aot470_92, aot470_93, aot470_94, aot470_95, aot470_96, aot470_995, &
3258 & aot412_91_dust, aot412_93_dust, aot412_94_dust, aot412_96_dust, aot412_995_dust, &
3259 & aot470_91_dust, aot470_92_dust, aot470_93_dust, aot470_94_dust, aot470_95_dust, &
3260 & aot470_96_dust, aot470_995_dust, ae, status, debug) result(aot500)
3264 character(len=20),
parameter :: func_name =
"get_aot500"
3266 real,
intent(in) :: lat
3267 real,
intent(in) :: lon
3268 real,
intent(in) :: elev
3269 real,
intent(in) :: sa
3270 integer,
intent(in) :: season
3271 real,
intent(in) :: ndvi
3272 integer,
intent(in) :: gzone
3273 integer,
intent(in) :: lc_type
3274 real,
intent(in) :: stdv02
3275 real,
intent(in) :: aot412_91, aot412_93, aot412_94, aot412_96, aot412_995
3276 real,
intent(in) :: aot470_91, aot470_92, aot470_93, aot470_94, aot470_95
3277 real,
intent(in) :: aot470_96, aot470_995
3278 real,
intent(in) :: aot412_91_dust, aot412_93_dust, aot412_94_dust, aot412_96_dust, aot412_995_dust
3279 real,
intent(in) :: aot470_91_dust, aot470_92_dust, aot470_93_dust, aot470_94_dust, aot470_95_dust
3280 real,
intent(in) :: aot470_96_dust, aot470_995_dust
3281 real,
intent(in) :: ae
3282 integer,
intent(inout) :: status
3283 logical,
intent(in),
optional :: debug
3286 integer :: ilat, ilon
3289 character(len=255) :: asite
3290 real,
dimension(:),
allocatable :: maero412, maero470, maero650
3291 integer,
dimension(:),
allocatable :: msiteindx
3292 integer,
dimension(:),
allocatable :: sorted
3294 integer :: i, ii, jj, cnt
3296 real :: aot500_1, aot500_2
3301 if (
present(debug)) dflag = debug
3307 ilat = floor(lat*10.0) + 900 + 1
3308 ilon = floor(lon*10.0) + 1800 + 1
3310 if (ilat > 1800) ilat = 1800
3311 if (ilon > 3600) ilon = 3600
3312 if (dflag) print *,
trim(func_name)//
', lat, lon, ilat, ilon: ', lat, lon, ilat, ilon
3315 refsr650 = brdf650(ilon,ilat)
3319 m = count(aero_zones == gzone .AND. aero_types == lc_type .AND. (elev < 500 .EQV. aero_elev < 500))
3322 if (gzone == 16 .OR. (gzone == 17 .OR. gzone == 2) .OR. gzone == 22)
then
3323 m = count(aero_zones == gzone .AND. (elev < 500 .EQV. aero_elev < 500))
3327 if (gzone == 18 .OR. gzone == 12 .OR. (gzone == 26 .OR. gzone == 27) .OR. gzone == 29)
then
3328 m = count(aero_zones == gzone)
3333 if (gzone == 28)
then
3334 m = count(aero_zones == gzone)
3338 if (gzone == 20)
then
3339 m = count(aero_zones == gzone)
3343 if (gzone == 30)
then
3344 m = count(aero_zones == gzone)
3348 if (gzone == 19)
then
3349 m = count(aero_zones == gzone)
3353 if (gzone == 15)
then
3354 m = count(aero_zones == gzone)
3358 if ((gzone == 5 .AND. lc_type == 2) .OR. gzone == 1 .or. gzone == 13)
then
3359 m = count(aero_zones == gzone .AND. aero_types == lc_type)
3364 if (gzone == 31 .AND. elev < 750)
then
3365 m = count(aero_zones == gzone)
3372 if (
allocated(maero412))
deallocate(maero412, stat=status)
3373 if (
allocated(maero470))
deallocate(maero470, stat=status)
3374 if (
allocated(maero650))
deallocate(maero650, stat=status)
3375 if (
allocated(msiteindx))
deallocate(msiteindx, stat=status)
3376 if (
allocated(sorted))
deallocate(sorted, stat=status)
3377 allocate(maero412(m), maero470(m), maero650(m), msiteindx(m), &
3378 sorted(m), stat=status)
3379 if (status /= 0)
then
3380 print *,
"ERROR: Failed to allocate AERONET 650 SR match arrays: ", status
3387 do i = 1,
size(aero_sites)
3389 case (2, 16, 17, 22)
3390 if (aero_zones(i) == gzone .AND. (elev < 500 .EQV. aero_elev(i) < 500))
then
3392 maero412(cnt) = aero_sr412(i,season)
3393 maero470(cnt) = aero_sr470(i,season)
3394 maero650(cnt) = aero_sr650(i,3)
3398 print
'(3(A,1X),I4,I4)',
trim(func_name),
', matching site: ',
trim(aero_sites(i)), aero_zones(i), aero_types(i)
3399 print
'(A,A,3(F11.6))',
trim(func_name),
', AERONET Baseline SR, 412, 470, 650: ', &
3400 & maero412(cnt), maero470(cnt), maero650(cnt)
3403 case (18, 12, 20, 26, 27, 28, 29, 30, 31)
3404 if (aero_zones(i) == gzone)
then
3406 maero412(cnt) = aero_sr412(i,season)
3407 maero470(cnt) = aero_sr470(i,season)
3408 maero650(cnt) = aero_sr650(i,3)
3412 print
'(A,A,A,I4,I4)',
trim(func_name),
', matching site: ',
trim(aero_sites(i)), aero_zones(i), aero_types(i)
3413 print
'(A,A,3(F11.6,1X))',
trim(func_name),
', AERONET Baseline SR: ', maero412(cnt), maero470(cnt), maero650(cnt)
3417 if (aero_zones(i) == gzone)
then
3419 maero412(cnt) = aero_sr412(i,season)
3420 maero470(cnt) = aero_sr470(i,season)
3421 maero650(cnt) = aero_sr650(i,3)
3425 print
'(A,A,A,I4,I4)',
trim(func_name),
', matching site: ',
trim(aero_sites(i)), aero_zones(i), aero_types(i)
3426 print
'(A,A,3(F11.6,1X))',
trim(func_name),
', AERONET Baseline SR: ', maero412(cnt), maero470(cnt), maero650(cnt)
3430 if (aero_zones(i) == gzone .AND. aero_types(i) == lc_type)
then
3432 maero412(cnt) = aero_sr412(i,season)
3433 maero470(cnt) = aero_sr470(i,season)
3434 maero650(cnt) = aero_sr650(i,3)
3438 print
'(A,A,A,I4,I4)',
trim(func_name),
', matching site: ',
trim(aero_sites(i)), aero_zones(i), aero_types(i)
3439 print
'(A,A,3(F11.6,1X))',
trim(func_name),
', AERONET Baseline SR: ', maero412(cnt), maero470(cnt), maero650(cnt)
3443 if (aero_zones(i) == gzone .AND. aero_types(i) == lc_type .AND. (elev < 500 .EQV. aero_elev(i) < 500))
then
3445 maero412(cnt) = aero_sr412(i,season)
3446 maero470(cnt) = aero_sr470(i,season)
3447 maero650(cnt) = aero_sr650(i,3)
3451 print
'(3(A,1X),I4,I4)',
trim(func_name),
', matching site: ',
trim(aero_sites(i)), aero_zones(i), aero_types(i)
3452 print
'(A,A,3(F11.6))',
trim(func_name),
', AERONET Baseline SR, 412, 470, 650: ', &
3453 & maero412(cnt), maero470(cnt), maero650(cnt)
3460 call sortrx(m, maero650, sorted)
3461 if (refsr650 >= minval(maero650) .AND. refsr650 < maxval(maero650))
then
3465 if (refsr650 >= maero650(sorted(i)) .AND. refsr650 < maero650(sorted(i+1)))
then
3467 asite = aero_sites(msiteindx(ii))
3468 aot500_1 = get_aeronet_aot500(asite, lat, lon, sa, season, ndvi, stdv02, &
3469 & aot412_91, aot412_93, aot412_94, aot412_96, aot412_995, &
3470 & aot470_91, aot470_92, aot470_93, aot470_94, aot470_95, aot470_96, aot470_995, &
3471 & aot412_91_dust, aot412_93_dust, aot412_94_dust, aot412_96_dust, aot412_995_dust, &
3472 & aot470_91_dust, aot470_92_dust, aot470_93_dust, aot470_94_dust, aot470_95_dust, &
3473 & aot470_96_dust, aot470_995_dust, ae, status, debug=dflag)
3474 if (status /= 0)
then
3475 print *,
"ERROR: Failed to get AOT@500nm from AERONET site: ",
trim(asite), status
3480 asite = aero_sites(msiteindx(jj))
3481 aot500_2 = get_aeronet_aot500(asite, lat, lon, sa, season, ndvi, stdv02, &
3482 & aot412_91, aot412_93, aot412_94, aot412_96, aot412_995, &
3483 & aot470_91, aot470_92, aot470_93, aot470_94, aot470_95, aot470_96, aot470_995, &
3484 & aot412_91_dust, aot412_93_dust, aot412_94_dust, aot412_96_dust, aot412_995_dust, &
3485 & aot470_91_dust, aot470_92_dust, aot470_93_dust, aot470_94_dust, aot470_95_dust, &
3486 & aot470_96_dust, aot470_995_dust, ae, status, debug=dflag)
3487 if (status /= 0)
then
3488 print *,
"ERROR: Failed to get AOT@500nm from AERONET site: ",
trim(asite), status
3493 frac = (refsr650-maero650(ii)) / (maero650(jj)-maero650(ii))
3495 aot500 = (1.0-frac)*aot500_1 + frac*aot500_2
3498 print *,
trim(func_name),
", Pixel Ref. SR, 650: ", refsr650
3500 print *,
trim(func_name),
', interp sites: ',
trim(aero_sites(msiteindx(ii))),
' ',
trim(aero_sites(msiteindx(jj)))
3501 print *,
trim(func_name),
', aot values, 412: ', aot412_91, aot412_93, aot412_94, aot412_96, aot412_995
3502 print *,
trim(func_name),
", aot values, 470: ", aot470_91, aot470_92, aot470_93, &
3503 & aot470_94, aot470_95, aot470_96, aot470_995
3504 print *,
trim(func_name),
', aot500: ', aot500
3514 if (refsr650 <= minval(maero650))
then
3520 asite = aero_sites(msiteindx(ii))
3521 aot500 = get_aeronet_aot500( asite, lat, lon, sa, season, ndvi, stdv02, &
3522 & aot412_91, aot412_93, aot412_94, aot412_96, aot412_995, &
3523 & aot470_91, aot470_92, aot470_93, aot470_94, aot470_95, aot470_96, aot470_995, &
3524 & aot412_91_dust, aot412_93_dust, aot412_94_dust, aot412_96_dust, aot412_995_dust, &
3525 & aot470_91_dust, aot470_92_dust, aot470_93_dust, aot470_94_dust, aot470_95_dust, &
3526 & aot470_96_dust, aot470_995_dust, ae, status, debug=dflag)
3527 if (status /= 0)
then
3528 print *,
"ERROR: Failed to get AOT at 500nm over AERONET site, single: ",
trim(asite), status
3533 print *,
trim(func_name),
", Pixel Ref. SR, 650: ", refsr650
3535 print *,
trim(func_name),
', interp site: ',
trim(aero_sites(msiteindx(ii)))
3536 print *,
trim(func_name),
', aot values, 412: ', aot412_91, aot412_93, aot412_94, aot412_96, aot412_995
3537 print *,
trim(func_name),
", aot values, 470: ", aot470_91, aot470_92, aot470_93, &
3538 & aot470_94, aot470_95, aot470_96, aot470_995
3539 print *,
trim(func_name),
', aot500: ', aot500
3556 real function get_aeronet_aot500(aero_site, lat, lon, sca, season, ndvi, stdv02, &
3557 & aot412_91, aot412_93, aot412_94, aot412_96, aot412_995, &
3558 & aot470_91, aot470_92, aot470_93, aot470_94, aot470_95, aot470_96, aot470_995, &
3559 & aot412_91_dust, aot412_93_dust, aot412_94_dust, aot412_96_dust, aot412_995_dust, &
3560 & aot470_91_dust, aot470_92_dust, aot470_93_dust, aot470_94_dust, aot470_95_dust, &
3561 & aot470_96_dust, aot470_995_dust, ae, status, debug) result(aot500)
3565 character(len=20),
parameter :: func_name =
"get_aeronet_aot500"
3567 character(len=255),
intent(in) :: aero_site
3568 real,
intent(in) :: sca
3569 real,
intent(in) :: lat, lon
3570 integer,
intent(in) :: season
3571 real,
intent(in) :: ndvi
3572 real,
intent(in) :: stdv02
3573 real,
intent(in) :: aot412_91, aot412_93, aot412_94, aot412_96, aot412_995
3574 real,
intent(in) :: aot470_91, aot470_92, aot470_93, aot470_94
3575 real,
intent(in) :: aot470_95, aot470_96, aot470_995
3576 real,
intent(in) :: aot412_91_dust, aot412_93_dust, aot412_94_dust, aot412_96_dust, aot412_995_dust
3577 real,
intent(in) :: aot470_91_dust, aot470_92_dust,aot470_93_dust, aot470_94_dust, aot470_95_dust
3578 real,
intent(in) :: aot470_96_dust, aot470_995_dust
3579 real,
intent(in) :: ae
3580 integer,
intent(inout) :: status
3581 logical,
intent(in),
optional :: debug
3585 real :: model_frac, model_frac2
3594 if (
present(debug)) dflag = debug
3596 select case (aero_site)
3599 select case (season)
3604 if (aot412_94 >= 0.6)
then
3605 aot500 = (aot412_93 + aot412_91)/2.0
3611 if (aot412_94 >= 0.6)
then
3614 if (aot500 >= 1.3)
then
3615 aot500 = (aot470_91 + aot470_92)/2.0
3621 if (aot470_96 >= 0.5)
then
3624 if (aot470_96 >= 0.7)
then
3625 aot500 = aot470_91 * 1.1
3631 if (aot412_94 >= 0.5)
then
3632 aot500 = (aot412_91 + aot412_93) / 2.0
3637 print *,
"ERROR: Invalid season specified: ", season
3643 case (
"IER_Cinzana")
3644 select case (season)
3649 if (aot470_94 >= 0.8)
then
3659 if (aot500 > 0.6)
then
3669 if (ndvi >= 0.3)
then
3677 if (ndvi < 0.36)
then
3684 print *,
"ERROR: Invalid season specified: ", season
3690 case (
"Zinder_Airport")
3691 select case (season)
3704 if (aot470_96 > 0.6 .AND. ndvi < 0.18)
then
3707 if (aot470_96 > 1.0 .AND. ndvi < 0.18)
then
3716 print *,
"ERROR: Invalid season specified: ", season
3722 case (
"Banizoumbou")
3723 select case (season)
3728 if (aot500 < 0.4)
then
3729 aot500 = (aot412_96 + aot412_995) / 2.0
3746 aot500 = (aot470_96 + aot470_995) / 2.0
3747 if (aot470_96 > 0.7)
then
3764 print *,
"ERROR: Invalid season specified: ", season
3772 select case (season)
3778 model_frac2 = 1.0-(lon-85.0)/5.0
3783 if (aot500 < 0.5)
then
3785 elseif (aot500 < 1.0)
then
3786 model_frac = 1.0-(aot500-0.5)/0.5*(1.0-model_frac2)
3788 model_frac = model_frac2
3790 aot500 = aot412_96*model_frac+aot412_94*(1.0-model_frac)
3796 if (aot500 < 0.6)
then
3798 elseif (aot500 < 1.2)
then
3799 model_frac = 1.0-(aot500-0.6)/0.6
3803 aot500 = aot412_96*model_frac+aot412_94*(1.0-model_frac)
3814 model_frac2 = 1.0-(lon-85.0)/5.0
3819 if (aot500 < 0.5)
then
3821 elseif (aot500 < 1.0)
then
3822 model_frac = 1.0-(aot500-0.5)/0.5*(1.0-model_frac2)
3824 model_frac = model_frac2
3826 aot500 = aot412_96*model_frac+aot412_94*(1.0-model_frac)
3830 print *,
"ERROR: Invalid season specified: ", season
3836 case (
"Tinga_Tingana")
3837 select case (season)
3841 if (aot412_94 < 1.2)
then
3859 print *,
"ERROR: Invalid season specified: ", season
3866 select case (season)
3869 if (aot412_94 < 1.2)
then
3877 if (aot412_94 < 0.5)
then
3884 print *,
"ERROR: Invalid season specified: ", season
3890 select case (season)
3895 if (aot500 < 0.5)
then
3896 model_frac = 1.0-(aot500-0.0)/0.5
3897 aot500 = aot470_96*model_frac + aot470_94*(1.0-model_frac)
3905 if (aot500 < 0.5)
then
3906 model_frac = 1.0-(aot500-0.0)/0.5
3907 aot500 = aot470_995*model_frac + aot470_94*(1.0-model_frac)
3919 if (aot500 < 0.5)
then
3920 model_frac = 1.0-(aot500-0.0)/0.5
3921 aot500 = aot470_995*model_frac + aot470_94*(1.0-model_frac)
3927 print *,
"ERROR: Invalid season specified: ", season
3933 case (
"Fresno_GZ18")
3934 select case (season)
3947 if (aot470_995 > 0.3)
then
3948 aot500 = aot470_96 + aot470_995 / 2.0
3956 print *,
"ERROR: Invalid season specified: ", season
3963 select case (season)
3982 print *,
"ERROR: Invalid season specified: ", season
3989 select case (season)
3994 if (aot470_96 > 0.5)
then
3995 aot500 = (aot470_94+aot470_92)/2.
4001 if (ndvi < 0.18 .and. aot470_96 > 0.4)
then
4002 aot500 = (aot470_94+aot470_96)/2.
4005 if (aot470_96 > 0.6)
then
4013 if (aot470_96 > 1.0)
then
4014 aot500 = (aot470_94+aot470_96)/2.
4021 if (aot470_96 > 0.7)
then
4026 print *,
"ERROR: Invalid season specified: ", season
4033 select case (season)
4040 print *,
"ERROR: Invalid season specified: ", season
4047 select case (season)
4058 print *,
"ERROR: Invalid season specified: ", season
4065 select case (season)
4070 if (aot470_96 < 0.4)
then
4075 if (aot470_96 < 0.4)
then
4080 if (aot470_96 < 0.3)
then
4084 print *,
"ERROR: Invalid season specified: ", season
4090 select case (season)
4095 print *,
"ERROR: Invalid season specified: ", season
4101 select case (season)
4103 if (ndvi < 0.28)
then
4114 if (aot412_995 > 0.2)
then
4117 if (aot412_995 > 0.3)
then
4125 print *,
"ERROR: Invalid season specified: ", season
4132 select case (season)
4135 if (aot412_94 >= 0.4)
then
4138 if (aot412_94 >= 0.8)
then
4143 if (aot412_94 >= 0.4)
then
4146 if (aot412_94 >= 0.8)
then
4149 if (stdv02 > 0.007)
then
4153 print *,
"ERROR: Invalid season specified: ", season
4158 case (
"Solar_Village")
4159 select case (season)
4162 if (aot412_93 > 0.5)
then
4163 aot500 = (aot412_93 + aot412_91) / 2.0
4181 print *,
"ERROR: Invalid season specified: ", season
4186 case (
"Lecce_University")
4187 select case (season)
4191 if (ndvi > 0.4)
then
4194 aot500 = (aot470_96 + aot470_995) / 2.0
4199 if (aot412_995 < 0.2)
then
4207 print *,
"ERROR: Invalid season specified: ", season
4213 select case (season)
4228 print *,
"ERROR: Invalid season specified: ", season
4234 select case (season)
4242 if (ndvi < 0.2)
then
4249 print *,
"ERROR: Invalid season specified: ", season
4256 select case (season)
4261 if (aot500 < 0.5)
then
4263 elseif (aot500 < 1.0)
then
4264 model_frac = 1.0-(aot500-0.5)/0.5
4268 aot500 = aot412_96*model_frac+aot412_94*(1.0-model_frac)
4273 if (aot500 < 0.6)
then
4275 elseif (aot500 < 1.2)
then
4276 model_frac = 1.0-(aot500-0.6)/0.6
4280 aot500 = aot412_96*model_frac+aot412_94*(1.0-model_frac)
4291 model_frac2 = 1.0-(lon-85.0)/5.0
4296 if (aot500 < 0.5)
then
4298 elseif (aot500 < 1.0)
then
4299 model_frac = 1.0-(aot500-0.5)/0.5*(1.0-model_frac2)
4301 model_frac = model_frac2
4303 aot500 = aot412_96*model_frac+aot412_94*(1.0-model_frac)
4307 print *,
"ERROR: Invalid season specified: ", season
4314 select case (season)
4332 print *,
"ERROR: Invalid season specified: ", season
4338 select case (season)
4356 print *,
"ERROR: Invalid season specified: ", season
4362 select case (season)
4380 print *,
"ERROR: Invalid season specified: ", season
4386 select case (season)
4390 aot412_92 = (aot412_91+aot412_93)/2.0
4414 if (aot500 < 0.5)
then
4416 elseif (aot500 < 1.0)
then
4417 model_frac = 1.0-(aot500-0.5)/0.5
4421 aot500 = aot412_94*model_frac+aot412_93*(1.0-model_frac)
4446 print *,
"ERROR: Invalid season specified: ", season
4451 case (
"Ilorin_Transition")
4452 select case (season)
4457 if (aot500 < 0.5)
then
4459 elseif (aot500 < 1.0)
then
4460 model_frac = 1.0-(aot500-0.5)/0.5
4464 aot500 = aot412_96*model_frac+aot412_94*(1.0-model_frac)
4475 if (aot412_94 < 0.5)
then
4477 elseif (aot412_94 < 1.0)
then
4478 model_frac = 1.0-(aot500-0.5)/0.5
4482 aot500 = aot412_995*model_frac+aot412_96*(1.0-model_frac)
4499 if (aot412_94 < 0.5)
then
4501 elseif (aot412_94 < 1.0)
then
4502 model_frac = 1.0-(aot500-0.5)/0.5
4506 aot500 = aot412_995*model_frac+aot412_96*(1.0-model_frac)
4516 print *,
"ERROR: Invalid season specified: ", season
4523 select case (season)
4528 print *,
"ERROR: Invalid season specified: ", season
4534 case (
"Mexico_City")
4535 select case (season)
4549 print *,
"ERROR: Invalid season specified: ", season
4556 select case (season)
4570 print *,
"ERROR: Invalid season specified: ", season
4576 case (
"NW_India_Desert")
4577 select case (season)
4591 print *,
"ERROR: Invalid season specified: ", season
4598 select case (season)
4612 print *,
"ERROR: Invalid season specified: ", season
4618 print *,
"ERROR: No data for AERONET site specified: ", aero_site
4626 print *,
trim(func_name),
', AERONET site: ', aero_site
4627 print *,
trim(func_name),
', season, ndvi, stdv02: ', season, ndvi, stdv02
4628 print
'(A,A,12(F10.4,1x))',
trim(func_name),
', aot values: ', aot412_91, aot412_93, aot412_94, &
4629 & aot412_96, aot412_995, aot470_91, aot470_92, aot470_93, &
4630 & aot470_94, aot470_95, aot470_96, aot470_995
4631 print *,
trim(func_name),
', ae: ', ae
4632 print *,
trim(func_name),
', aot500: ', aot500
4636 end function get_aeronet_aot500
4639 integer function set_limits(locedge, lat, long)
RESULT(status)
4641 integer,
intent(in) :: locedge(2)
4642 real,
intent(in) :: lat(locedge(1),locedge(2)), long(locedge(1),locedge(2))
4644 integer :: checkvariable
4646 character (len=256) :: msg
4647 real :: eastedge, westedge
4662 if (minval(long, long > -900.0) < -175.0 .and. maxval(long, long > -900.0) > 175.0)
then
4667 if (long(i,j) < -900.0) cycle
4668 if (long(i,j) > 0.0 .and. long(i,j) < eastedge) eastedge = long(i,j)
4669 if (long(i,j) < 0.0 .and. long(i,j) > westedge) westedge = long(i,j)
4672 lerstart(1) = 10*(180+floor(eastedge)-1)
4673 if (lerstart(1) .le. 0) lerstart(1) = 1
4674 dateline = 3600 - lerstart(1)
4675 leredge(1) = 10*(180+(floor(westedge)+2)) + dateline
4677 lerstart(1) = 10*(180+(floor(minval(long, long > -900.0))-1))
4678 if (lerstart(1) .le. 0) lerstart(1) = 1
4679 leredge(1) = 10*(180+(floor(maxval(long, long > -900.0))+2)) - lerstart(1)
4680 if (leredge(1)+lerstart(1) > 3600) leredge(1) = 3600 - lerstart(1)
4683 lerstart(2) = 10*(90+(floor(minval(lat, lat > -900.0))-1))
4684 if (lerstart(2) .le. 0) lerstart(2) = 1
4685 leredge(2) = 10*(90+(floor(maxval(lat, lat > -900.0))+2)) - lerstart(2)
4686 if (leredge(2)+lerstart(2) > 1800) leredge(2) = 1800 - lerstart(2)
4688 if (
allocated(gref412_all))
deallocate(gref412_all)
4689 allocate (gref412_all(leredge(1),leredge(2)), stat = checkvariable)
4690 if ( checkvariable /= 0 )
goto 90
4692 if (
allocated(gref470_all))
deallocate(gref470_all)
4693 allocate (gref470_all(leredge(1),leredge(2)), stat = checkvariable)
4694 if ( checkvariable /= 0 )
goto 90
4696 if (
allocated(gref650_all))
deallocate(gref650_all)
4697 allocate (gref650_all(leredge(1),leredge(2)), stat = checkvariable)
4698 if ( checkvariable /= 0 )
goto 90
4700 if (
allocated(gref412_fwd))
deallocate(gref412_fwd)
4701 allocate (gref412_fwd(leredge(1),leredge(2)), stat = checkvariable)
4702 if ( checkvariable /= 0 )
goto 90
4704 if (
allocated(gref470_fwd))
deallocate(gref470_fwd)
4705 allocate (gref470_fwd(leredge(1),leredge(2)), stat = checkvariable)
4706 if ( checkvariable /= 0 )
goto 90
4708 if (
allocated(gref650_fwd))
deallocate(gref650_fwd)
4709 allocate (gref650_fwd(leredge(1),leredge(2)), stat = checkvariable)
4710 if ( checkvariable /= 0 )
goto 90
4724 if (
allocated(gref865_all))
deallocate(gref865_all)
4725 allocate (gref865_all(leredge(1),leredge(2)), stat = checkvariable)
4726 if ( checkvariable /= 0 )
goto 90
4736 if (
allocated(coefs412_all))
deallocate(coefs412_all)
4737 allocate (coefs412_all(leredge(1),leredge(2),4,3), stat = checkvariable)
4738 if ( checkvariable /= 0 )
goto 90
4740 if (
allocated(coefs412_fwd))
deallocate(coefs412_fwd)
4741 allocate (coefs412_fwd(leredge(1),leredge(2),4,3), stat = checkvariable)
4742 if ( checkvariable /= 0 )
goto 90
4752 if (
allocated(coefs470_all))
deallocate(coefs470_all)
4753 allocate (coefs470_all(leredge(1),leredge(2),4,3), stat = checkvariable)
4754 if ( checkvariable /= 0 )
goto 90
4756 if (
allocated(coefs470_fwd))
deallocate(coefs470_fwd)
4757 allocate (coefs470_fwd(leredge(1),leredge(2),4,3), stat = checkvariable)
4758 if ( checkvariable /= 0 )
goto 90
4768 if (
allocated(coefs650_all))
deallocate(coefs650_all)
4769 allocate (coefs650_all(leredge(1),leredge(2),4,3), stat = checkvariable)
4770 if ( checkvariable /= 0 )
goto 90
4772 if (
allocated(coefs650_fwd))
deallocate(coefs650_fwd)
4773 allocate (coefs650_fwd(leredge(1),leredge(2),4,3), stat = checkvariable)
4774 if ( checkvariable /= 0 )
goto 90
4777 if (
allocated(vgref412_all))
deallocate(vgref412_all)
4778 allocate (vgref412_all(leredge(1),leredge(2)), stat = checkvariable)
4779 if ( checkvariable /= 0 )
goto 90
4781 if (
allocated(vgref488_all))
deallocate(vgref488_all)
4782 allocate (vgref488_all(leredge(1),leredge(2)), stat = checkvariable)
4783 if ( checkvariable /= 0 )
goto 90
4785 if (
allocated(vgref670_all))
deallocate(vgref670_all)
4786 allocate (vgref670_all(leredge(1),leredge(2)), stat = checkvariable)
4787 if ( checkvariable /= 0 )
goto 90
4792 print *,
"ERROR: Unable to allocate coefficient array: ", status
4802 integer function set_limits6(locedge, lat, long)
RESULT(status)
4804 integer,
intent(in) :: locedge(2)
4805 real,
intent(in) :: lat(locedge(1),locedge(2)), long(locedge(1),locedge(2))
4807 integer :: checkvariable
4809 character (len=256) :: msg
4810 real :: eastedge, westedge
4827 if (minval(long, long > -900.0) < -175.0 .and. maxval(long, long > -900.0) > 175.0)
then
4832 if (long(i,j) < -900.0) cycle
4833 if (long(i,j) > 0.0 .and. long(i,j) < eastedge) eastedge = long(i,j)
4834 if (long(i,j) < 0.0 .and. long(i,j) > westedge) westedge = long(i,j)
4837 lerstart6(1) = (180+(floor(eastedge)-1))/0.06
4838 if (lerstart6(1) .le. 0) lerstart6(1) = 1
4839 dateline6 = 6000 - lerstart6(1)
4840 leredge6(1) = (180+(floor(westedge)+2))/0.06 + dateline6
4842 lerstart6(1) = (180+(floor(minval(long, long > -900.0))-1))/0.06
4843 if (lerstart6(1) .le. 0) lerstart6(1) = 1
4844 leredge6(1) = (180+(floor(maxval(long, long > -900.0))+2))/0.06 - lerstart6(1)
4845 if (leredge6(1)+lerstart6(1) > 6000) leredge6(1) = 6000 - lerstart6(1)
4848 lerstart6(2) = (90+(floor(minval(lat, lat > -900.0))-1))/0.06
4849 if (lerstart6(2) .le. 0) lerstart6(2) = 1
4850 leredge6(2) = (90+(floor(maxval(lat, lat > -900.0))+2))/0.06 - lerstart6(2)
4851 if (leredge6(2)+lerstart6(2) > 3000) leredge6(2) = 3000 - lerstart6(2)
4853 if (
allocated(swir_coeffs412))
deallocate(swir_coeffs412)
4854 allocate (swir_coeffs412(leredge6(1),leredge6(2),3), stat = checkvariable)
4855 if ( checkvariable /= 0 )
goto 90
4857 if (
allocated(swir_coeffs470))
deallocate(swir_coeffs470)
4858 allocate (swir_coeffs470(leredge6(1),leredge6(2),3), stat = checkvariable)
4859 if ( checkvariable /= 0 )
goto 90
4861 if (
allocated(swir_stderr412))
deallocate(swir_stderr412)
4862 allocate (swir_stderr412(leredge6(1),leredge6(2)), stat = checkvariable)
4863 if ( checkvariable /= 0 )
goto 90
4865 if (
allocated(swir_stderr470))
deallocate(swir_stderr470)
4866 allocate (swir_stderr470(leredge6(1),leredge6(2)), stat = checkvariable)
4867 if ( checkvariable /= 0 )
goto 90
4869 if (
allocated(swir_min))
deallocate(swir_min)
4870 allocate (swir_min(leredge6(1),leredge6(2)), stat = checkvariable)
4871 if ( checkvariable /= 0 )
goto 90
4873 if (
allocated(swir_max))
deallocate(swir_max)
4874 allocate (swir_max(leredge6(1),leredge6(2)), stat = checkvariable)
4875 if ( checkvariable /= 0 )
goto 90
4880 print *,
"ERROR: Unable to allocate 2.2 um surface database array: ", status
4889 integer function load_hdfler(lut_file, season)
RESULT(status)
4895 character(len=255),
intent(in) :: lut_file
4896 integer,
intent(in) :: season
4898 integer :: start2(3), stride2(3), edges2(3)
4899 integer :: start4(5), stride4(5), edge4(5)
4901 character(len=255) :: sds_name
4902 character(len=255) :: dset_name
4903 character(len=255) :: test_name
4904 character(len=255) :: group_name
4910 integer :: sd_id, sds_index, sds_id
4912 start2 = (/lerstart(1),lerstart(2),season/)
4913 edges2 = (/leredge(1),leredge(2),1/)
4916 start4 = (/lerstart(1),lerstart(2),1,1,season/)
4917 edge4 = (/leredge(1),leredge(2),4,3,1/)
4918 stride4 = (/1,1,1,1,1/)
4920 test_name =
trim(lut_file)
4921 status = nf90_open(test_name, nf90_nowrite, nc_id)
4922 if (status /= nf90_noerr)
then
4923 print *,
"ERROR: Failed to open deepblue lut_nc4 file: ", status
4927 group_name =
'SURFACE_COEFFICIENTS'
4928 status = nf90_inq_ncid(nc_id, group_name, grp_id)
4929 if (status /= nf90_noerr)
then
4930 print *,
"ERROR: Failed to get ID of group "//
trim(group_name)//
": ", status
4942 sds_name =
"SC412_FWD"
4943 status = readler5(start4, edge4, stride4, sds_name, grp_id, coefs412_fwd)
4944 if (status < 0)
goto 90
4946 sds_name =
"SC412_ALL"
4947 status = readler5(start4, edge4, stride4, sds_name, grp_id, coefs412_all)
4948 if (status < 0)
goto 90
4958 sds_name =
"SC470_FWD"
4959 status = readler5(start4, edge4, stride4, sds_name, grp_id, coefs470_fwd)
4960 if (status < 0)
goto 90
4962 sds_name =
"SC470_ALL"
4963 status = readler5(start4, edge4, stride4, sds_name, grp_id, coefs470_all)
4964 if (status < 0)
goto 90
4974 sds_name =
"SC650_FWD"
4975 status = readler5(start4, edge4, stride4, sds_name, grp_id, coefs650_fwd)
4976 if (status < 0)
goto 90
4978 sds_name =
"SC650_ALL"
4979 status = readler5(start4, edge4, stride4, sds_name, grp_id, coefs650_all)
4980 if (status < 0)
goto 90
4982 status = nf90_close(nc_id)
4983 if (status /= nf90_noerr)
then
4984 print *,
"ERROR: Failed to close lut_nc4 file: ", status
4989 status = nf90_open(
trim(lut_file), nf90_nowrite, nc_id)
4990 if (status /= nf90_noerr)
then
4991 print *,
"ERROR: Failed to open deepblue lut_nc4 file: ", status
4995 group_name =
'MODIS_SURFACE_REFLECTANCE'
4996 status = nf90_inq_ncid(nc_id, group_name, grp_id)
4997 if (status /= nf90_noerr)
then
4998 print *,
"ERROR: Failed to get ID of group "//
trim(group_name)//
": ", status
5002 sds_name =
"SR412_ALL"
5003 status = readler2(start2, edges2, stride2, sds_name, grp_id, gref412_all)
5004 if (status < 0)
goto 90
5006 sds_name =
"SR412_FWD"
5007 status = readler2(start2, edges2, stride2, sds_name, grp_id, gref412_fwd)
5008 if (status < 0)
goto 90
5014 sds_name =
"SR470_ALL"
5015 status = readler2(start2, edges2, stride2, sds_name, grp_id, gref470_all)
5016 if (status < 0)
goto 90
5018 sds_name =
"SR470_FWD"
5019 status = readler2(start2, edges2, stride2, sds_name, grp_id, gref470_fwd)
5020 if (status < 0)
goto 90
5026 sds_name =
"SR650_ALL"
5027 status = readler2(start2, edges2, stride2, sds_name, grp_id, gref650_all)
5028 if (status < 0)
goto 90
5030 sds_name =
"SR650_FWD"
5031 status = readler2(start2, edges2, stride2, sds_name, grp_id, gref650_fwd)
5032 if (status < 0)
goto 90
5038 sds_name =
"SR865_ALL"
5039 status = readler2(start2, edges2, stride2, sds_name, grp_id, gref865_all)
5040 if (status < 0)
goto 90
5042 status = nf90_close(nc_id)
5043 if (status /= nf90_noerr)
then
5044 print *,
"ERROR: Failed to close lut_nc4 file: ", status
5049 status = nf90_open(
trim(lut_file), nf90_nowrite, nc_id)
5050 if (status /= nf90_noerr)
then
5051 print *,
"ERROR: Failed to open deepblue lut_nc4 file: ", status
5055 group_name =
'VIIRS_SURFACE_REFLECTANCE'
5056 status = nf90_inq_ncid(nc_id, group_name, grp_id)
5057 if (status /= nf90_noerr)
then
5058 print *,
"ERROR: Failed to get ID of group "//
trim(group_name)//
": ", status
5064 sds_name =
"SR412_ALL"
5065 status = readler2(start2, edges2, stride2, sds_name, grp_id, vgref412_all)
5066 if (status < 0)
goto 90
5068 sds_name =
"SR488_ALL"
5069 status = readler2(start2, edges2, stride2, sds_name, grp_id, vgref488_all)
5070 if (status < 0)
goto 90
5072 sds_name =
"SR670_ALL"
5073 status = readler2(start2, edges2, stride2, sds_name, grp_id, vgref670_all)
5074 if (status < 0)
goto 90
5076 status = nf90_close(nc_id)
5077 if (status /= nf90_noerr)
then
5078 print *,
"ERROR: Failed to close lut_nc4 file: ", status
5086 print *,
"Error reading "//
trim(sds_name)//
" from file "//
trim(lut_file)
5101 character(len=255),
intent(in) :: file
5102 integer,
intent(in) :: season
5105 character(len=255) :: sds_name
5106 character(len=255) :: dset_name
5107 character(len=255) :: attr_name
5108 character(len=255) :: group_name
5114 integer :: sd_id, sds_index, sds_id
5115 integer,
dimension(3) :: start2, stride2, edges2
5116 integer,
dimension(4) :: start3, stride3, edges3
5120 start2 = (/lerstart6(1),lerstart6(2),season/)
5121 edges2 = (/leredge6(1),leredge6(2),1/)
5124 start3 = (/lerstart6(1),lerstart6(2),1,season/)
5125 edges3 = (/leredge6(1),leredge6(2),3,1/)
5126 stride3 =(/1,1,1,1/)
5128 status = nf90_open(file, nf90_nowrite, nc_id)
5129 if (status /= nf90_noerr)
then
5130 print *,
"ERROR: Failed to open deepblue lut_nc4 file: ", status
5134 group_name =
'SWIR_VS_VISIBLE'
5135 status = nf90_inq_ncid(nc_id, group_name, grp_id)
5136 if (status /= nf90_noerr)
then
5137 print *,
"ERROR: Failed to get ID of group "//
trim(group_name)//
": ", status
5141 sds_name =
'coeffs_2250_to_412'
5142 status =
readswir3(start3, edges3, stride3, sds_name, grp_id, swir_coeffs412)
5143 if (status < 0)
goto 90
5145 sds_name =
'stderr_412'
5146 status =
readswir2(start2, edges2, stride2, sds_name, grp_id, swir_stderr412)
5147 if (status < 0)
goto 90
5149 sds_name =
'coeffs_2250_to_488'
5150 status =
readswir3(start3, edges3, stride3, sds_name, grp_id, swir_coeffs470)
5151 if (status < 0)
goto 90
5153 sds_name =
'stderr_488'
5154 status =
readswir2(start2, edges2, stride2, sds_name, grp_id, swir_stderr470)
5155 if (status < 0)
goto 90
5157 sds_name =
'min_2250_for_488'
5158 status =
readswir2(start2, edges2, stride2, sds_name, grp_id, swir_min)
5159 if (status < 0)
goto 90
5161 sds_name =
'max_2250_for_488'
5162 status =
readswir2(start2, edges2, stride2, sds_name, grp_id, swir_max)
5163 if (status < 0)
goto 90
5166 status = nf90_close(nc_id)
5167 if (status /= nf90_noerr)
then
5168 print *,
"ERROR: Failed to close lut_nc4 file: ", status
5175 print *,
"Error reading "//
trim(sds_name)//
" from file "//
trim(file)
5185 integer,
intent(in) :: latidx, lonidx
5189 if (dateline6 .eq. 0 .OR. lonidx .gt. lerstart6(1))
then
5190 i = lonidx - lerstart6(1)
5192 i = lonidx + dateline6
5194 j = latidx - lerstart6(2)
5202 integer,
intent(in) :: latidx, lonidx
5206 if (dateline6 .eq. 0 .OR. lonidx .gt. lerstart6(1))
then
5207 i = lonidx - lerstart6(1)
5209 i = lonidx + dateline6
5211 j = latidx - lerstart6(2)
5219 integer,
intent(in) :: latidx, lonidx
5222 if (dateline6 .eq. 0 .OR. lonidx .gt. lerstart6(1))
then
5223 i = lonidx - lerstart6(1)
5225 i = lonidx + dateline6
5227 j = latidx - lerstart6(2)
5229 stderr = swir_stderr412(i,j)
5235 integer,
intent(in) :: latidx, lonidx
5238 if (dateline6 .eq. 0 .OR. lonidx .gt. lerstart6(1))
then
5239 i = lonidx - lerstart6(1)
5241 i = lonidx + dateline6
5243 j = latidx - lerstart6(2)
5245 stderr = swir_stderr470(i,j)
5251 integer,
intent(in) :: latidx, lonidx
5255 if (dateline6 .eq. 0 .OR. lonidx .gt. lerstart6(1))
then
5256 i = lonidx - lerstart6(1)
5258 i = lonidx + dateline6
5260 j = latidx - lerstart6(2)
5267 real function
get_ler865(latidx, lonidx) result(ler)
5268 integer,
intent(in) :: latidx, lonidx
5272 if (dateline .eq. 0 .OR. lonidx .gt. lerstart(1))
then
5273 i = lonidx - lerstart(1)
5275 i = lonidx + dateline
5277 j = latidx - lerstart(2)
5279 ler = gref865_all(i,j)
5285 real function
get_ler412(latidx, lonidx, ndvi, scatangle, relaz) result(ler)
5286 integer,
intent(in) :: latidx, lonidx
5287 real,
intent(in) :: ndvi, scatangle, relaz
5290 real :: coefs(4), acoefs(4), ncoefs(4), mcoefs(4), tler
5293 if (dateline .eq. 0 .OR. lonidx .gt. lerstart(1))
then
5294 i = lonidx - lerstart(1)
5296 i = lonidx + dateline
5298 j = latidx - lerstart(2)
5306 if (ndvi < ndvi1_cutoff)
then
5308 elseif (ndvi < ndvi2_cutoff)
then
5314 if (relaz < 90.0)
then
5318 ncoefs(:) = coefs412_fwd(i,j,:,nidx)
5321 tler = vgref412_all(i,j)
5326 ncoefs(:) = coefs412_all(i,j,:,nidx)
5329 tler = vgref412_all(i,j)
5344 if (maxval(ncoefs) > 0.0)
then
5345 coefs(:) = ncoefs(:)
5354 if (maxval(coefs) > 0.0)
then
5355 ler = coefs(1) + scatangle*(coefs(2) + scatangle*(coefs(3) + scatangle*coefs(4)))
5366 real function
get_ler470(latidx, lonidx, ndvi, scatangle, relaz) result(ler)
5367 integer,
intent(in) :: latidx, lonidx
5368 real,
intent(in) :: ndvi, scatangle, relaz
5371 real :: coefs(4), acoefs(4), ncoefs(4), mcoefs(4), tler
5374 if (dateline .eq. 0 .OR. lonidx .gt. lerstart(1))
then
5375 i = lonidx - lerstart(1)
5377 i = lonidx + dateline
5379 j = latidx - lerstart(2)
5387 if (ndvi < ndvi1_cutoff)
then
5389 elseif (ndvi < ndvi2_cutoff)
then
5398 if (relaz < 90.0)
then
5402 ncoefs(:) = coefs470_fwd(i,j,:,nidx)
5405 tler = vgref488_all(i,j)
5410 ncoefs(:) = coefs470_all(i,j,:,nidx)
5413 tler = vgref488_all(i,j)
5428 if (maxval(ncoefs) > 0.0)
then
5429 coefs(:) = ncoefs(:)
5430 elseif (maxval(acoefs) > 0.0)
then
5431 coefs(:) = acoefs(:)
5432 elseif (maxval(mcoefs) > 0.0)
then
5433 coefs(:) = mcoefs(:)
5438 if (maxval(coefs) > 0.0)
then
5439 ler = coefs(1) + scatangle*(coefs(2) + scatangle*(coefs(3) + scatangle*coefs(4)))
5450 real function
get_ler650(latidx, lonidx, ndvi, scatangle, relaz) result(ler)
5451 integer,
intent(in) :: latidx, lonidx
5452 real,
intent(in) :: ndvi, scatangle, relaz
5455 real :: coefs(4), acoefs(4), ncoefs(4), mcoefs(4), tler
5458 if (dateline .eq. 0 .OR. lonidx .gt. lerstart(1))
then
5459 i = lonidx - lerstart(1)
5461 i = lonidx + dateline
5463 j = latidx - lerstart(2)
5472 if (ndvi < ndvi1_cutoff)
then
5474 elseif (ndvi < ndvi2_cutoff)
then
5480 if (relaz < 90.0)
then
5484 ncoefs(:) = coefs650_fwd(i,j,:,nidx)
5487 tler = vgref670_all(i,j)
5492 ncoefs(:) = coefs650_all(i,j,:,nidx)
5495 tler = vgref670_all(i,j)
5510 if (maxval(ncoefs) > 0.0)
then
5511 coefs(:) = ncoefs(:)
5520 if (maxval(coefs) > 0.0)
then
5521 ler = coefs(1) + scatangle*(coefs(2) + scatangle*(coefs(3) + scatangle*coefs(4)))
5531 integer function readler2(start, edge, stride, sds_name, grp_id, outref)
RESULT(status)
5539 integer,
dimension(3),
intent(in) :: start, edge, stride
5540 integer,
intent(in) :: grp_id
5541 real,
intent(out) :: outref(edge(1),edge(2))
5544 character(len=255) :: sds_name
5545 character(len=255) :: dset_name
5546 character(len=255) :: attr_name
5547 character(len=255) :: group_name
5552 integer :: sds_index, sds_id
5553 integer,
dimension(3) :: tmpedge, tmpstart
5554 real,
dimension(:,:),
allocatable :: tmpout
5556 dset_name = sds_name
5557 status = nf90_inq_varid(grp_id, dset_name, dset_id)
5558 if (status /= nf90_noerr)
then
5559 print *,
"ERROR: Failed to get ID of dataset "//
trim(dset_name)//
": ", status
5563 if (dateline .eq. 0)
then
5564 status = nf90_get_var(grp_id, dset_id, outref, start=start, &
5565 stride=stride, count=edge)
5566 if (status /= nf90_noerr)
then
5567 print *,
"ERROR: Failed to read dataset "//
trim(dset_name)//
": ", status
5572 tmpedge(:) = edge(:)
5573 tmpedge(1) = dateline
5574 allocate(tmpout(tmpedge(1), tmpedge(2)), stat=status)
5575 if (status /= 0)
then
5576 print *,
"ERROR: Unable to allocate tmpedge: ", status
5579 status = nf90_get_var(grp_id, dset_id, tmpout, start=start, &
5580 stride=stride, count=tmpedge)
5581 if (status /= nf90_noerr)
then
5582 print *,
"ERROR: Failed to read dataset "//
trim(dset_name)//
": ", status
5585 outref(1:dateline, :) = tmpout
5587 deallocate(tmpout, stat=status)
5588 if (status /= 0)
then
5589 print *,
"Failed to deallocate tmpout: ", status
5593 tmpstart(:) = start(:)
5595 tmpedge(1) = edge(1) - dateline
5596 allocate(tmpout(tmpedge(1), tmpedge(2)), stat=status)
5597 if (status /= 0)
then
5598 print *,
"ERROR: Unable to allocate tmpedge: ", status
5601 status = nf90_get_var(grp_id, dset_id, tmpout, start=tmpstart, &
5602 stride=stride, count=tmpedge)
5603 if (status /= nf90_noerr)
then
5604 print *,
"ERROR: Failed to read dataset "//
trim(dset_name)//
": ", status
5607 outref(dateline+1:edge(1),:) = tmpout
5609 deallocate(tmpout, stat=status)
5610 if (status /= 0)
then
5611 print *,
"Failed to deallocate tmpout: ", status
5617 end function readler2
5620 integer function readler5(start, edge, stride, sds_name, grp_id, outref)
RESULT(status)
5628 integer,
dimension(:),
intent(in) :: start, edge, stride
5629 character(len=255),
intent(in) :: sds_name
5630 integer,
intent(in) :: grp_id
5631 real,
dimension(:,:,:,:),
intent(inout) :: outref
5634 character(len=255) :: dset_name
5639 integer :: sds_index, sds_id
5640 integer,
dimension(5) :: tmpedge, tmpstart
5641 real,
dimension(:,:,:,:),
allocatable :: tmpout
5642 character(len=255) :: tmp_name
5643 integer :: rank, ntype, nattrs
5644 integer,
dimension(5) :: dims
5648 dset_name = sds_name
5649 status = nf90_inq_varid(grp_id, dset_name, dset_id)
5650 if (status /= nf90_noerr)
then
5651 print *,
"ERROR: Failed to get ID of dataset "//
trim(dset_name)//
": ", status
5655 if (dateline .eq. 0)
then
5657 status = nf90_get_var(grp_id, dset_id, outref, start=start, &
5658 stride=stride, count=edge)
5659 if (status /= nf90_noerr)
then
5660 print *,
"ERROR: Failed to read dataset "//
trim(dset_name)//
": ", status
5665 tmpedge(:) = edge(:)
5666 tmpedge(1) = dateline
5667 allocate(tmpout(tmpedge(1), tmpedge(2), tmpedge(3), tmpedge(4)), stat=status)
5668 if (status /= 0)
then
5669 print *,
"ERROR: Unable to allocate tmpedge: ", status
5672 status = nf90_get_var(grp_id, dset_id, tmpout, start=start, &
5673 stride=stride, count=tmpedge)
5674 if (status /= nf90_noerr)
then
5675 print *,
"ERROR: Failed to read dataset "//
trim(dset_name)//
": ", status
5678 outref(1:dateline, :, :, :) = tmpout(:,:,:,:)
5680 deallocate(tmpout, stat=status)
5681 if (status /= 0)
then
5682 print *,
"Failed to deallocate tmpout: ", status
5686 tmpstart(:) = start(:)
5688 tmpedge(1) = edge(1) - dateline
5689 allocate(tmpout(tmpedge(1), tmpedge(2), tmpedge(3), tmpedge(4)), stat=status)
5690 if (status /= 0)
then
5691 print *,
"ERROR: Unable to allocate tmpedge: ", status
5694 status = nf90_get_var(grp_id, dset_id, tmpout, start=tmpstart, &
5695 stride=stride, count=tmpedge)
5696 if (status /= nf90_noerr)
then
5697 print *,
"ERROR: Failed to read dataset "//
trim(dset_name)//
": ", status
5700 outref(dateline+1:edge(1),:,:,:) = tmpout(:,:,:,:)
5702 deallocate(tmpout, stat=status)
5703 if (status /= 0)
then
5704 print *,
"Failed to deallocate tmpout: ", status
5712 end function readler5
5715 integer function readswir2(start, edge, stride, sds_name, grp_id, outref)
RESULT(status)
5723 integer,
dimension(3),
intent(in) :: start, edge, stride
5724 integer,
intent(in) :: grp_id
5725 real,
intent(out) :: outref(edge(1),edge(2))
5728 character(len=255) :: sds_name
5729 character(len=255) :: dset_name
5730 character(len=255) :: attr_name
5731 character(len=255) :: group_name
5736 integer :: sds_index, sds_id
5737 integer,
dimension(3) :: tmpedge, tmpstart
5738 real,
dimension(:,:),
allocatable :: tmpout
5740 dset_name = sds_name
5741 status = nf90_inq_varid(grp_id, dset_name, dset_id)
5742 if (status /= nf90_noerr)
then
5743 print *,
"ERROR: Failed to get ID of dataset "//
trim(dset_name)//
": ", status
5747 if (dateline6 .eq. 0)
then
5748 status = nf90_get_var(grp_id, dset_id, outref, start=start, &
5749 stride=stride, count=edge)
5750 if (status /= nf90_noerr)
then
5751 print *,
"ERROR: Failed to read dataset "//
trim(dset_name)//
": ", status
5756 tmpedge(:) = edge(:)
5757 tmpedge(1) = dateline6
5758 allocate(tmpout(tmpedge(1), tmpedge(2)), stat=status)
5759 if (status /= 0)
then
5760 print *,
"ERROR: Unable to allocate tmpedge: ", status
5763 status = nf90_get_var(grp_id, dset_id, tmpout, start=start, &
5764 stride=stride, count=tmpedge)
5765 if (status /= nf90_noerr)
then
5766 print *,
"ERROR: Failed to read dataset "//
trim(dset_name)//
": ", status
5769 outref(1:dateline6, :) = tmpout
5771 deallocate(tmpout, stat=status)
5772 if (status /= 0)
then
5773 print *,
"Failed to deallocate tmpout: ", status
5777 tmpstart(:) = start(:)
5779 tmpedge(1) = edge(1) - dateline6
5780 allocate(tmpout(tmpedge(1), tmpedge(2)), stat=status)
5781 if (status /= 0)
then
5782 print *,
"ERROR: Unable to allocate tmpedge: ", status
5785 status = nf90_get_var(grp_id, dset_id, tmpout, start=tmpstart, &
5786 stride=stride, count=tmpedge)
5787 if (status /= nf90_noerr)
then
5788 print *,
"ERROR: Failed to read dataset "//
trim(dset_name)//
": ", status
5791 outref(dateline6+1:edge(1),:) = tmpout
5793 deallocate(tmpout, stat=status)
5794 if (status /= 0)
then
5795 print *,
"Failed to deallocate tmpout: ", status
5804 integer function readswir3(start3, edges3, stride3, sds_name, grp_id, outref)
RESULT(status)
5812 integer,
dimension(4),
intent(in) :: start3, edges3, stride3
5813 integer,
intent(in) :: grp_id
5814 real,
dimension(:,:,:),
intent(inout) :: outref
5816 character(len=255) :: sds_name
5817 character(len=255) :: dset_name
5818 character(len=255) :: attr_name
5819 character(len=255) :: group_name
5824 integer :: sds_index, sds_id
5825 integer,
dimension(4) :: tmpedge, tmpstart
5826 real,
dimension(:,:,:),
allocatable :: tmpout
5827 character(len=255) :: tmp_name
5828 integer :: rank, ntype, nattrs
5829 integer,
dimension(4) :: dims
5833 dset_name = sds_name
5834 status = nf90_inq_varid(grp_id, dset_name, dset_id)
5835 if (status /= nf90_noerr)
then
5836 print *,
"ERROR: Failed to get ID of dataset "//
trim(dset_name)//
": ", status
5840 if (dateline6 .eq. 0)
then
5841 status = nf90_get_var(grp_id, dset_id, outref, start=start3, &
5842 stride=stride3, count=edges3)
5843 if (status /= nf90_noerr)
then
5844 print *,
"ERROR: Failed to read dataset "//
trim(dset_name)//
": ", status
5849 tmpedge(:) = edges3(:)
5850 tmpedge(1) = dateline6
5851 allocate(tmpout(tmpedge(1), tmpedge(2), tmpedge(3)), stat=status)
5852 if (status /= 0)
then
5853 print *,
"ERROR: Unable to allocate tmpedge: ", status
5856 status = nf90_get_var(grp_id, dset_id, tmpout, start=start3, &
5857 stride=stride3, count=tmpedge)
5858 if (status /= nf90_noerr)
then
5859 print *,
"ERROR: Failed to read dataset "//
trim(dset_name)//
": ", status
5862 outref(1:dateline6, :, :) = tmpout
5864 deallocate(tmpout, stat=status)
5865 if (status /= 0)
then
5866 print *,
"Failed to deallocate tmpout: ", status
5870 tmpstart(:) = start3(:)
5872 tmpedge(1) = edges3(1) - dateline6
5873 allocate(tmpout(tmpedge(1), tmpedge(2), tmpedge(3)), stat=status)
5874 if (status /= 0)
then
5875 print *,
"ERROR: Unable to allocate tmpedge: ", status
5878 status = nf90_get_var(grp_id, dset_id, tmpout, start=tmpstart, &
5879 stride=stride3, count=tmpedge)
5880 if (status /= nf90_noerr)
then
5881 print *,
"ERROR: Failed to read dataset "//
trim(dset_name)//
": ", status
5884 outref(dateline6+1:edges3(1),:,:) = tmpout
5886 deallocate(tmpout, stat=status)
5887 if (status /= 0)
then
5888 print *,
"Failed to deallocate tmpout: ", status
5894 dset_name = sds_name
5895 status = nf90_inq_varid(grp_id, dset_name, dset_id)
5896 if (status /= nf90_noerr)
then
5897 print *,
"ERROR: Failed to get ID of dataset "//
trim(dset_name)//
": ", status
5901 if (dateline6 .eq. 0)
then
5902 status = nf90_get_var(grp_id, dset_id, tmpout, start=start3, &
5903 stride=stride3, count=edges3)
5904 if (status /= nf90_noerr)
then
5905 print *,
"ERROR: Failed to read dataset "//
trim(dset_name)//
": ", status
5910 tmpedge(:) = edges3(:)
5911 tmpedge(1) = dateline6
5912 allocate(tmpout(tmpedge(1), tmpedge(2), tmpedge(3)), stat=status)
5913 if (status /= 0)
then
5914 print *,
"ERROR: Unable to allocate tmpedge: ", status
5917 status = nf90_get_var(grp_id, dset_id, tmpout, start=start3, &
5918 stride=stride3, count=tmpedge)
5919 if (status /= nf90_noerr)
then
5920 print *,
"ERROR: Failed to read dataset "//
trim(dset_name)//
": ", status
5923 outref(1:dateline6, :, :) = tmpout
5925 deallocate(tmpout, stat=status)
5926 if (status /= 0)
then
5927 print *,
"Failed to deallocate tmpout: ", status
5931 tmpstart(:) = start3(:)
5933 tmpedge(1) = edges3(1) - dateline6
5934 allocate(tmpout(tmpedge(1), tmpedge(2), tmpedge(3)), stat=status)
5935 if (status /= 0)
then
5936 print *,
"ERROR: Unable to allocate tmpedge: ", status
5939 status = nf90_get_var(grp_id, dset_id, tmpout, start=tmpstart, &
5940 stride=stride3, count=tmpedge)
5941 if (status /= nf90_noerr)
then
5942 print *,
"ERROR: Failed to read dataset "//
trim(dset_name)//
": ", status
5945 outref(dateline6+1:edges3(1),:,:) = tmpout
5947 deallocate(tmpout, stat=status)
5948 if (status /= 0)
then
5949 print *,
"Failed to deallocate tmpout: ", status
5959 real,
intent(in) :: lat
5960 real,
intent(in) :: lon
5961 integer,
intent(inout) :: ilat
5962 integer,
intent(inout) :: ilon
5965 if (lat > 90.0 .OR. lat < -90.0)
then
5966 print *,
"ERROR: Invalid latitude specified: ", lat
5970 if (lon > 180.0 .OR. lon < -180.0)
then
5971 print *,
"ERROR: Invalid longitude specified: ", lon
5976 ilat = (lat + 90.0) * 10.0 + 1
5977 if (ilat > 1800) ilat = 1800
5978 if (ilat < 1) ilat = 1
5980 ilon = (lon + 180.0) * 10.0 + 1
5981 if (ilon > 3600) ilon = 3600
5982 if (ilon < 1) ilon = 1
5991 integer,
intent(in) :: latidx
5992 integer,
intent(out) :: lonidx
5996 if (dateline .eq. 0 .OR. lonidx .gt. lerstart(1))
then
5997 i = lonidx - lerstart(1)
5999 i = lonidx + dateline
6001 j = latidx - lerstart(2)
6003 ref = vgref412_all(i,j)
6011 integer,
intent(in) :: latidx
6012 integer,
intent(out) :: lonidx
6016 if (dateline .eq. 0 .OR. lonidx .gt. lerstart(1))
then
6017 i = lonidx - lerstart(1)
6019 i = lonidx + dateline
6021 j = latidx - lerstart(2)
6023 ref = vgref488_all(i,j)
6031 integer,
intent(in) :: latidx
6032 integer,
intent(out) :: lonidx
6036 if (dateline .eq. 0 .OR. lonidx .gt. lerstart(1))
then
6037 i = lonidx - lerstart(1)
6039 i = lonidx + dateline
6041 j = latidx - lerstart(2)
6043 ref = vgref670_all(i,j)
6051 integer,
intent(in) :: latidx
6052 integer,
intent(out) :: lonidx
6056 if (dateline .eq. 0 .OR. lonidx .gt. lerstart(1))
then
6057 i = lonidx - lerstart(1)
6059 i = lonidx + dateline
6061 j = latidx - lerstart(2)
6063 ref = gref412_all(i,j)
6071 integer,
intent(in) :: latidx
6072 integer,
intent(out) :: lonidx
6076 if (dateline .eq. 0 .OR. lonidx .gt. lerstart(1))
then
6077 i = lonidx - lerstart(1)
6079 i = lonidx + dateline
6081 j = latidx - lerstart(2)
6083 ref = gref470_all(i,j)
6091 integer,
intent(in) :: latidx
6092 integer,
intent(out) :: lonidx
6096 if (dateline .eq. 0 .OR. lonidx .gt. lerstart(1))
then
6097 i = lonidx - lerstart(1)
6099 i = lonidx + dateline
6101 j = latidx - lerstart(2)
6103 ref = gref650_all(i,j)
6111 integer,
intent(in) :: latidx
6112 integer,
intent(out) :: lonidx
6116 if (dateline .eq. 0 .OR. lonidx .gt. lerstart(1))
then
6117 i = lonidx - lerstart(1)
6119 i = lonidx + dateline
6121 j = latidx - lerstart(2)
6123 ref = gref865_all(i,j)
6131 integer,
intent(in) :: ilat
6132 integer,
intent(out) :: ilon
6133 real,
intent(in) :: ndvi
6134 real,
intent(in) :: sa
6135 real,
intent(in) :: ra
6143 mb_sr412 =
get_ler412(ilat, ilon, ndvi, sa, ra)
6144 if (mb_sr412 < -900.0)
then
6150 if (m_sr412 < -900.0)
then
6156 if (v_sr412 < -900.0)
then
6161 ref = v_sr412 * (mb_sr412 / m_sr412)
6169 integer,
intent(in) :: ilat
6170 integer,
intent(out) :: ilon
6171 real,
intent(in) :: ndvi
6172 real,
intent(in) :: sa
6173 real,
intent(in) :: ra
6181 mb_sr470 =
get_ler470(ilat, ilon, ndvi, sa, ra)
6182 if (mb_sr470 < -900.0)
then
6188 if (m_sr470 < -900.0)
then
6194 if (v_sr488 < -900.0)
then
6199 ref = v_sr488 * (mb_sr470 / m_sr470)
6208 integer,
intent(in) :: ilat
6209 integer,
intent(out) :: ilon
6210 real,
intent(in) :: ndvi
6211 real,
intent(in) :: sa
6212 real,
intent(in) :: ra
6220 mb_sr650 =
get_ler650(ilat, ilon, ndvi, sa, ra)
6221 if (mb_sr650 < -900.0)
then
6227 if (m_sr650 < -900.0)
then
6233 if (v_sr670 < -900.0)
then
6238 ref = v_sr670 * (mb_sr650 / m_sr650)
6248 real,
intent(in) :: lat
6249 real,
intent(in) :: lon
6251 integer :: ilat, ilon
6256 if (lat > 90.0 .OR. lat < -90.0)
then
6257 print *,
"ERROR: Invalid latitude specified: ", lat
6261 if (lon > 180.0 .OR. lon < -180.0)
then
6262 print *,
"ERROR: Invalid longitude specified: ", lon
6267 ilat = (lat + 90.0) * 10 + 1
6268 if (ilat > 1800) ilat = 1800
6269 if (ilat < 1) ilat = 1
6271 ilon = (lon + 180.0) * 10 + 1
6272 if (ilon > 3600) ilon = 3600
6273 if (ilon < 1) ilon = 1
6286 real,
intent(in) :: lat
6287 real,
intent(in) :: lon
6289 integer :: ilat, ilon
6294 if (lat > 90.0 .OR. lat < -90.0)
then
6295 print *,
"ERROR: Invalid latitude specified: ", lat
6299 if (lon > 180.0 .OR. lon < -180.0)
then
6300 print *,
"ERROR: Invalid longitude specified: ", lon
6305 ilat = (lat + 90.0) * 10 + 1
6306 if (ilat > 1800) ilat = 1800
6307 if (ilat < 1) ilat = 1
6309 ilon = (lon + 180.0) * 10 + 1
6310 if (ilon > 3600) ilon = 3600
6311 if (ilon < 1) ilon = 1
6323 real,
intent(in) :: lat
6324 real,
intent(in) :: lon
6325 integer,
intent(in) :: season
6327 integer :: ilat, ilon
6332 if (lat > 90.0 .OR. lat < -90.0)
then
6333 print *,
"ERROR: Invalid latitude specified: ", lat
6337 if (lon > 180.0 .OR. lon < -180.0)
then
6338 print *,
"ERROR: Invalid longitude specified: ", lon
6343 ilat = floor(lat + 90.0) + 1
6344 if (ilat > 180) ilat = 180
6345 if (ilat < 1) ilat = 1
6347 ilon = floor(lon + 180.0) + 1
6348 if (ilon > 360) ilon = 360
6349 if (ilon < 1) ilon = 1
6351 aod = bg_aod(ilon,ilat)