Changeset 54a8a01 in flex_extract.git for python/EcFlexpart.py
- Timestamp:
- Aug 31, 2018, 7:50:37 AM (6 years ago)
- Branches:
- master, ctbto, dev
- Children:
- 597d4d1
- Parents:
- e1228f3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/EcFlexpart.py
re1228f3 r54a8a01 1 1 #!/usr/bin/env python 2 2 # -*- coding: utf-8 -*- 3 #************************************************************************4 # ToDo AP5 # - specifiy file header documentation6 # - add class description in header information7 # - apply classtests8 # - add references to ECMWF specific software packages9 # - add describtion of deacc_fluxes10 # - change name of func deacc ( weil disagg )11 # - add desc of retrieve function12 #************************************************************************13 3 #******************************************************************************* 14 4 # @Author: Anne Fouilloux (University of Oslo) … … 151 141 152 142 fluxes: boolean, optional 153 Decides if athe flux parameter settings are stored or143 Decides if the flux parameter settings are stored or 154 144 the rest of the parameter list. 155 145 Default value is False. … … 175 165 self.dtime = c.dtime 176 166 i = 0 177 if fluxes is True and c.maxstep <24:167 if fluxes and c.maxstep <= 24: 178 168 # no forecast beyond one day is needed! 179 169 # Thus, prepare flux data manually as usual … … 192 182 btlist = [13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 0] 193 183 194 if i % int(c.dtime) == 0 and c.maxstep > 24 or i in btlist:184 if i % int(c.dtime) == 0 and (i in btlist or c.maxstep > 24): 195 185 196 186 if ty not in self.types.keys(): … … 207 197 self.types[ty]['steps'] += st 208 198 i += 1 209 210 199 211 200 self.marsclass = c.marsclass … … 304 293 '{}'.format((int(self.resol) + 1) / 2)] 305 294 306 if c.omega == '1':295 if hasattr(c, 'omega') and c.omega == '1': 307 296 self.params['OG__ML'][0] += '/W' 308 297 309 298 # add cloud water content if necessary 310 if c.cwc == '1':299 if hasattr(c, 'cwc') and c.cwc == '1': 311 300 self.params['OG__ML'][0] += '/CLWC/CIWC' 312 301 313 302 # add vorticity and geopotential height for WRF if necessary 314 if c.wrf == '1':303 if hasattr(c, 'wrf') and c.wrf == '1': 315 304 self.params['OG__ML'][0] += '/Z/VO' 316 305 if '/D' not in self.params['OG__ML'][0]: … … 740 729 c.gateway, '-remote', c.destination, 741 730 '-source', ofile]) 742 print('ectrans:', p)731 #print('ectrans:', p) 743 732 744 733 if int(c.ecstorage) == 1 and c.ecapi is False: … … 890 879 891 880 for prod in product(*index_vals): 892 # flag for Fortran program CONVERT2 , initially False881 # flag for Fortran program CONVERT2 and file merging 893 882 convertFlag = False 894 883 print 'current prod: ', prod … … 906 895 # prepare some date and time parameter before reading the data 907 896 if gid is not None: 908 # Fortran program CONVERT2 is only done if gid at this time is 909 # not None, therefore save information in convertFlag 897 # Combine all temporary data files into final grib file if 898 # gid is at least one time not None. Therefore set convertFlag 899 # to save information. The fortran program CONVERT2 is also 900 # only done if convertFlag is True 910 901 convertFlag = True 911 902 # remove old fort.* files and open new ones 903 # they are just valid for a single product 912 904 for k, f in fdict.iteritems(): 913 905 silent_remove(c.inputdir + "/fort." + k) … … 922 914 '%Y%m%d%H') 923 915 timestamp += timedelta(hours=int(step)) 924 925 916 cdateH = datetime.strftime(timestamp, '%Y%m%d%H') 926 917 … … 966 957 levtype = grib_get(gid, 'typeOfLevel') 967 958 if paramId == 133 and gridtype == 'reduced_gg': 968 # Relativehumidity (Q.grb) is used as a template only959 # Specific humidity (Q.grb) is used as a template only 969 960 # so we need the first we "meet" 970 961 with open(c.inputdir + '/fort.18', 'w') as fout: … … 1028 1019 not available for this type or date/time\n' 1029 1020 print 'Check parameters CLASS, TYPE, STREAM, START_DATE\n' 1030 my_error(c , 'fort.21 is empty while parameter eta is set\1031 1021 my_error(c.mailfail, 'fort.21 is empty while parameter eta \ 1022 is set to 1 in CONTROL file') 1032 1023 1033 1024 # create the corresponding output file fort.15 … … 1061 1052 with open(fnout, 'wb') as fout: 1062 1053 for f in flist: 1063 shutil.copyfileobj(open(c.inputdir + '/' + f, 'rb'), fout) 1054 shutil.copyfileobj( 1055 open(c.inputdir + '/' + f, 'rb'), fout) 1064 1056 1065 1057 if c.omega == '1': … … 1068 1060 open(c.inputdir + '/fort.25', 'rb'), fout) 1069 1061 1070 if c.wrf == '1':1062 if hasattr(c, 'wrf') and c.wrf == '1': 1071 1063 fwrf.close() 1072 1064 … … 1307 1299 grib_index_release(iid) 1308 1300 1309 exit()1310 1301 return
Note: See TracChangeset
for help on using the changeset viewer.