1 |
#include "EXF_OPTIONS.h" |
#include "EXF_OPTIONS.h" |
2 |
|
|
3 |
subroutine exf_set_gen( |
subroutine exf_set_gen( |
4 |
& genfile, genstartdate, genperiod, exf_inscal_gen, |
& genfile, genstartdate, genperiod, |
5 |
|
& genstartdate1, genstartdate2, |
6 |
|
& exf_inscal_gen, |
7 |
& genfld, gen0, gen1, genmask, |
& genfld, gen0, gen1, genmask, |
8 |
#ifdef USE_EXF_INTERPOLATION |
#ifdef USE_EXF_INTERPOLATION |
9 |
& gen_lon0, gen_lon_inc, gen_lat0, gen_lat_inc, |
& gen_lon0, gen_lon_inc, gen_lat0, gen_lat_inc, |
42 |
|
|
43 |
c == routine arguments == |
c == routine arguments == |
44 |
|
|
45 |
|
integer genstartdate1, genstartdate2 |
46 |
_RL genstartdate, genperiod |
_RL genstartdate, genperiod |
47 |
_RL exf_inscal_gen |
_RL exf_inscal_gen |
48 |
_RL genfld(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL genfld(1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
49 |
_RL gen0 (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL gen0 (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
50 |
_RL gen1 (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
_RL gen1 (1-olx:snx+olx,1-oly:sny+oly,nsx,nsy) |
51 |
character*1 genmask |
character*1 genmask |
52 |
character*(128) genfile |
character*(128) genfile, genfile0, genfile1 |
53 |
_RL mycurrenttime |
_RL mycurrenttime |
54 |
integer mycurrentiter |
integer mycurrentiter |
55 |
integer mythid |
integer mythid |
71 |
|
|
72 |
logical first, changed |
logical first, changed |
73 |
integer count0, count1 |
integer count0, count1 |
74 |
|
integer year0, year1 |
75 |
_RL fac |
_RL fac |
76 |
|
|
77 |
integer bi, bj |
integer bi, bj |
78 |
integer i, j, interp_method |
integer i, j |
79 |
|
integer il, interp_method |
80 |
|
|
81 |
|
c == external == |
82 |
|
|
83 |
|
integer ilnblnk |
84 |
|
external ilnblnk |
85 |
|
|
86 |
c == end of interface == |
c == end of interface == |
87 |
|
|
88 |
if ( genfile .NE. ' ' ) then |
if ( genfile .NE. ' ' ) then |
89 |
|
|
90 |
|
cph( |
91 |
|
cph-exf-print if (genfile .EQ. hfluxfile) year0 = 3000 |
92 |
|
cph) |
93 |
c get record numbers and interpolation factor for gen |
c get record numbers and interpolation factor for gen |
94 |
call exf_GetFFieldRec( |
call exf_GetFFieldRec( |
95 |
I genstartdate, genperiod |
I genstartdate, genperiod |
96 |
|
I , genstartdate1, genstartdate2 |
97 |
|
I , useExfYearlyFields |
98 |
O , fac, first, changed |
O , fac, first, changed |
99 |
O , count0, count1 |
O , count0, count1, year0, year1 |
100 |
I , mycurrenttime, mycurrentiter, mythid |
I , mycurrenttime, mycurrentiter, mythid |
101 |
& ) |
& ) |
102 |
|
|
103 |
if ( first ) then |
if ( first ) then |
104 |
|
if (useExfYearlyFields) then |
105 |
|
il = ilnblnk( genfile ) |
106 |
|
write(genfile0(1:128),'(2a,i4.4)') |
107 |
|
& genfile(1:il),'_',year0 |
108 |
|
else |
109 |
|
genfile0 = genfile |
110 |
|
endif |
111 |
#ifdef USE_EXF_INTERPOLATION |
#ifdef USE_EXF_INTERPOLATION |
112 |
interp_method = 2 |
interp_method = 2 |
113 |
call exf_interp( genfile, exf_iprec |
call exf_interp( genfile0, exf_iprec |
114 |
& , gen1, count0, gen_xout, gen_yout |
& , gen1, count0, gen_xout, gen_yout |
115 |
& , gen_lon0,gen_lon_inc |
& , gen_lon0,gen_lon_inc |
116 |
& , gen_lat0,gen_lat_inc |
& , gen_lat0,gen_lat_inc |
117 |
& , gen_nlon,gen_nlat,interp_method,mythid |
& , gen_nlon,gen_nlat,interp_method,mythid |
118 |
& ) |
& ) |
119 |
#else |
#else |
120 |
call mdsreadfield( genfile, exf_iprec, exf_yftype, 1 |
call mdsreadfield( genfile0, exf_iprec, exf_yftype, 1 |
121 |
& , gen1, count0, mythid |
& , gen1, count0, mythid |
122 |
& ) |
& ) |
123 |
#endif |
#endif |
132 |
if (( first ) .or. ( changed )) then |
if (( first ) .or. ( changed )) then |
133 |
call exf_SwapFFields( gen0, gen1, mythid ) |
call exf_SwapFFields( gen0, gen1, mythid ) |
134 |
|
|
135 |
|
if (useExfYearlyFields) then |
136 |
|
il = ilnblnk( genfile ) |
137 |
|
write(genfile1(1:128),'(2a,i4.4)') |
138 |
|
& genfile(1:il),'_',year1 |
139 |
|
else |
140 |
|
genfile1 = genfile |
141 |
|
endif |
142 |
#ifdef USE_EXF_INTERPOLATION |
#ifdef USE_EXF_INTERPOLATION |
143 |
interp_method = 2 |
interp_method = 2 |
144 |
call exf_interp( genfile, exf_iprec |
call exf_interp( genfile1, exf_iprec |
145 |
& , gen1, count1, gen_xout, gen_yout |
& , gen1, count1, gen_xout, gen_yout |
146 |
& , gen_lon0,gen_lon_inc |
& , gen_lon0,gen_lon_inc |
147 |
& , gen_lat0,gen_lat_inc |
& , gen_lat0,gen_lat_inc |
148 |
& , gen_nlon,gen_nlat,interp_method,mythid |
& , gen_nlon,gen_nlat,interp_method,mythid |
149 |
& ) |
& ) |
150 |
#else |
#else |
151 |
call mdsreadfield( genfile, exf_iprec, exf_yftype, 1 |
call mdsreadfield( genfile1, exf_iprec, exf_yftype, 1 |
152 |
& , gen1, count1, mythid |
& , gen1, count1, mythid |
153 |
& ) |
& ) |
154 |
#endif |
#endif |