Changeset 0f89116 in flex_extract.git for Source/Python/Mods/checks.py
- Timestamp:
- Dec 19, 2019, 8:07:12 PM (4 years ago)
- Branches:
- master, ctbto, dev
- Children:
- a73c0f6
- Parents:
- 0d99607
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Source/Python/Mods/checks.py
r44174de r0f89116 29 29 import os 30 30 import sys 31 32 import _config 31 from datetime import datetime 32 # pylint: disable=unused-import 33 33 try: 34 34 import exceptions 35 35 except ImportError: 36 36 import builtins as exceptions 37 from datetime import datetime 37 # pylint: enable=unused-import 38 39 # software specific classes and modules from flex_extract 40 import _config 38 41 from Mods.tools import my_error, silent_remove 39 42 # ------------------------------------------------------------------------------ … … 113 116 return grid 114 117 115 def check_area(grid, area, upper, lower, left 118 def check_area(grid, area, upper, lower, left, right): 116 119 '''Defines the correct area string. 117 120 … … 158 161 159 162 # determine area format 160 if ((abs(float(upper) / 10000.) >= 0.01 or float(upper) / 1000. == 0. ) and161 (abs(float(lower) / 10000.) >= 0.01 or float(lower) / 1000. == 0. ) and162 (abs(float(left) / 10000.) >= 0.01 or float(left) / 1000. == 0. ) and163 (abs(float(right) / 10000.) >= 0.01 or float(right) / 1000. == 0.)):163 if all([(abs(float(upper) / 10000.) >= 0.01 or float(upper) / 1000. == 0.), 164 (abs(float(lower) / 10000.) >= 0.01 or float(lower) / 1000. == 0.), 165 (abs(float(left) / 10000.) >= 0.01 or float(left) / 1000. == 0.), 166 (abs(float(right) / 10000.) >= 0.01 or float(right) / 1000. == 0.)]): 164 167 # area is defined in 1/1000 degrees; old format 165 168 area = '{}/{}/{}/{}'.format(float(upper) / 1000., … … 167 170 float(lower) / 1000., 168 171 float(right) / 1000.) 169 elif (abs(float(upper) / 10000.) < 0.05 and170 abs(float(lower) / 10000.) < 0.05 and171 abs(float(left) / 10000.) < 0.05 and172 abs(float(right) / 10000.) < 0.05):172 elif all([abs(float(upper) / 10000.) < 0.05, 173 abs(float(lower) / 10000.) < 0.05, 174 abs(float(left) / 10000.) < 0.05, 175 abs(float(right) / 10000.) < 0.05]): 173 176 # area is already in new format 174 177 area = '{}/{}/{}/{}'.format(float(upper), … … 180 183 'formats (upper, lower, left, right): ' 181 184 '{}/{}/{}/{}'.format(str(upper), str(lower), 182 str(left) 185 str(left), str(right))) 183 186 184 187 return area … … 281 284 282 285 283 def check_step(step , mailfail):286 def check_step(step): 284 287 '''Checks on step format and convert into a list of steps. 285 288 … … 293 296 Specifies the forecast time step from forecast base time. 294 297 Valid values are hours (HH) from forecast base time. 295 296 mailfail : list of str297 Contains all email addresses which should be notified.298 It might also contain just the ecmwf user name which will trigger299 mailing to the associated email address for this user.300 298 301 299 Return … … 405 403 Valid values are hours (HH) from forecast base time. 406 404 ''' 407 if not (len(ftype) == len(ftime) == len(steps)):405 if not len(ftype) == len(ftime) == len(steps): 408 406 raise ValueError('ERROR: The number of field types, times and steps ' 409 407 'are not the same! Please check the setting in the ' … … 553 551 'in CONTROL file.\n' 554 552 'Try "{} -h" to print usage information' 555 .format(sys.argv[0].split('/')[-1]) 553 .format(sys.argv[0].split('/')[-1])) 556 554 557 555 # retrieve just one day if end_date isn't set … … 790 788 accmaxstep = maxstep 791 789 print('... For pure forecast mode, the accumulated forecast must ' 792 793 790 'have the same maxstep as the normal forecast fields!\n' 791 '\t\t Accmaxstep was set to maxstep!') 794 792 return accmaxstep 795 793 … … 851 849 852 850 853 def check_number(number , mailfail):851 def check_number(number): 854 852 '''Check for correct string format of ensemble member numbers. 855 853 … … 858 856 number : str 859 857 List of ensemble member forecast runs. 860 861 mailfail : list of str862 Contains all email addresses which should be notified.863 It might also contain just the ecmwf user name which will trigger864 mailing to the associated email address for this user.865 858 866 859 Return
Note: See TracChangeset
for help on using the changeset viewer.