Changeset efdb01a in flex_extract.git
- Timestamp:
- May 9, 2018, 12:15:00 PM (6 years ago)
- Branches:
- master, ctbto, dev
- Children:
- 991df6a
- Parents:
- 02c8c50
- Files:
-
- 10 added
- 1 deleted
- 16 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
python/CONTROL.temp
rd69b677 refdb01a 10 10 EXPVER 1 11 11 GRID 5000 12 LEFT -1 7500013 LOWER -9000014 UPPER 9000015 RIGHT 18000012 LEFT -15000 13 LOWER 30000 14 UPPER 75000 15 RIGHT 45000 16 16 LEVEL 60 17 LEVELIST 1/to/6017 LEVELIST 55/to/60 18 18 RESOL 63 19 19 GAUSS 1 … … 27 27 FORMAT GRIB1 28 28 ADDPAR 186/187/188/235/139/39 29 PREFIX E N30 ECSTORAGE 129 PREFIX EI 30 ECSTORAGE 0 31 31 ECTRANS 0 32 32 ECFSDIR ectmp:/${USER}/econdemand/ -
python/ECMWF_ENV
rd69b677 refdb01a 1 ECUID lh02 ECGID spatlh003 GATEWAY srvx 7.img.univie.ac.at4 DESTINATION leo@genericSftp1 ECUID km4a 2 ECGID at 3 GATEWAY srvx8.img.univie.ac.at 4 DESTINATION philipa8@genericSftp -
python/GribTools.py
r02c8c50 refdb01a 6 6 # - GribTools name möglicherweise etwas verwirrend. 7 7 # - change self.filename in self.filenames!!! 8 # - 8 # - add file description 9 # - bis auf --init-- und index wird keine Funktion verwendet!? 9 10 #************************************************************************ 10 11 """ … … 20 21 21 22 @License: 22 (C) Copyright 2014 UIO.23 (C) Copyright 2014-2018. 23 24 24 25 This software is licensed under the terms of the Apache Licence Version 2.0 … … 28 29 - A standard python 2.6 or 2.7 installation 29 30 - dateutils 30 - matplotlib (optional, for debugging)31 31 - ECMWF specific packages, all available from https://software.ecmwf.int/ 32 32 ECMWF WebMARS, gribAPI with python enabled, emoslib and … … 36 36 Further documentation may be obtained from www.flexpart.eu. 37 37 38 Functionality provided: 39 Prepare input 3D-wind fields in hybrid coordinates + 40 surface fields for FLEXPART runs 38 ... 41 39 """ 42 40 # ------------------------------------------------------------------------------ … … 45 43 from gribapi import * 46 44 import traceback 47 import sys , os48 45 import sys 46 import os 49 47 # ------------------------------------------------------------------------------ 50 48 # CLASS … … 55 53 ''' 56 54 # -------------------------------------------------------------------------- 57 # FUNCTIONS55 # CLASS FUNCTIONS 58 56 # -------------------------------------------------------------------------- 59 57 def __init__(self, filenames): -
python/UIOFiles.py
r02c8c50 refdb01a 4 4 # TODO AP 5 5 #AP 6 # - File name und Klassenname gleichsetzen?7 6 # - checken welche regelmässigen methoden auf diese Files noch angewendet werden 8 7 # und dann hier implementieren 9 # - löschen?8 # - add description of file! 10 9 #************************************************************************ 11 10 """ … … 15 14 16 15 @ChangeHistory: 17 February 2018 - Anne Philipp (University of Vienna): 16 November 2015 - Leopold Haimberger (University of Vienna): 17 - modified method listFiles to work with glob instead of listdir 18 - added pattern search in method listFiles 19 20 February 2018 - Anne Philipp (University of Vienna): 18 21 - applied PEP8 style guide 19 22 - added documentation 23 - optimisation of method listFiles since it didn't work correctly 24 for sub directories 25 - additional speed up of method listFiles 20 26 21 27 @License: 22 (C) Copyright 2014 UIO.28 (C) Copyright 2014-2018. 23 29 24 30 This software is licensed under the terms of the Apache Licence Version 2.0 … … 26 32 27 33 @Requirements: 28 - A standard python 2.6 or 2.7 installation 29 - dateutils 30 - matplotlib (optional, for debugging) 31 - ECMWF specific packages, all available from https://software.ecmwf.int/ 32 ECMWF WebMARS, gribAPI with python enabled, emoslib and 33 ecaccess web toolkit 34 A standard python 2.6 or 2.7 installation 34 35 35 36 @Description: 36 Further documentation may be obtained from www.flexpart.eu. 37 38 Functionality provided: 39 Prepare input 3D-wind fields in hybrid coordinates + 40 surface fields for FLEXPART runs 37 ... 41 38 """ 42 39 # ------------------------------------------------------------------------------ … … 45 42 import os 46 43 import glob 47 44 import fnmatch 45 import time 46 import profiling 48 47 # ------------------------------------------------------------------------------ 49 # C lass48 # CLASS 50 49 # ------------------------------------------------------------------------------ 51 50 class UIOFiles: … … 56 55 ''' 57 56 # -------------------------------------------------------------------------- 58 # FUNCTIONS57 # CLASS FUNCTIONS 59 58 # -------------------------------------------------------------------------- 60 59 def __init__(self, suffix): … … 80 79 return 81 80 82 def listFiles(self, path, pattern): 81 #@profiling.timefn 82 def listFiles(self, path, pattern, callid=0): 83 83 ''' 84 84 @Description: … … 98 98 '*OG_acc_SL*.'+c.ppid+'.*' 99 99 100 callid: integer 101 Id which tells the function if its the first call 102 or a recursive call. Default and first call is 0. 103 Everything different from 0 is ment to be a recursive case. 104 100 105 @Return: 101 106 <nothing> 102 107 ''' 103 108 109 # initialize variable in first function call 110 if callid == 0: 111 self.files = [] 112 104 113 # Get the absolute path 105 114 path = os.path.abspath(path) 106 115 107 # Get a list of files in pathname108 filesInCurDir0 = glob.glob(path + '/' + pattern)109 filesInCurDir = []110 for f in filesInCurDir0:111 filesInCurDir.append(f.split('/')[-1])116 # get the file list of the path if its not a directory and 117 # if it contains one of the suffixes 118 self.files.extend([os.path.join(path, k) for k in os.listdir(path) 119 if fnmatch.fnmatch(k, pattern) and 120 os.path.splitext(k)[-1] in self.suffix]) 112 121 113 self.counter = 0 114 self.files = [] 115 # Traverse through all files 116 for file in filesInCurDir: 117 curFile = os.path.join(path, file) 122 # find possible sub-directories in the path 123 subdirs = [s for s in os.listdir(path) 124 if os.path.isdir(os.path.join(path, s))] 118 125 119 # Check if it's a normal file or directory 120 if os.path.isfile(curFile): 121 # Get the file extension 122 fileNoExt, curFileExtension = os.path.splitext(curFile) 123 # Check if the file has an extension of typical video files 124 if curFileExtension in self.suffix: 125 # We have got a file file! Increment the counter 126 self.counter += 1 127 # add this filename in the list 128 self.files.append(curFile) 129 else: 130 # We got a directory, enter into it for further processing 131 self.listFiles(curFile) 126 # do recursive calls for sub-direcorties 127 if subdirs: 128 for subdir in subdirs: 129 self.listFiles(os.path.join(path, subdir), pattern, callid=1) 132 130 133 131 return -
python/compilejob.ksh
rd69b677 refdb01a 5 5 # start with sbatch NAME_OF_THIS_FILE directly on machine 6 6 7 #SBATCH --workdir=/scratch/ms/ spatlh00/lh07 #SBATCH --workdir=/scratch/ms/at/km4a 8 8 #SBATCH --qos=normal 9 9 #SBATCH --job-name=flex_ecmwf … … 25 25 26 26 set -x 27 export VERSION=7. 027 export VERSION=7.1 28 28 case $HOST in 29 29 *ecg*) … … 33 33 module load grib_api/1.14.5 34 34 module load emos/437-r64 35 export FLEXPART_ROOT_SCRIPTS=$ HOME36 # export ECMWFDATA=$FLEXPART_ROOT/ECMWFDATA 7.035 export FLEXPART_ROOT_SCRIPTS=${HOME} 36 # export ECMWFDATA=$FLEXPART_ROOT/ECMWFDATA$VERSION 37 37 # export PYTHONPATH=$ECMWFDATA/python 38 38 # export PATH=${PATH}:$ECMWFDATA/python … … 49 49 export GROUP=`echo $HOME | awk -F / '{print $4}'` 50 50 export SCRATCH=/scratch/ms/${GROUP}/${USER} 51 export FLEXPART_ROOT_SCRIPTS=$ HOME52 # export ECMWFDATA=$FLEXPART_ROOT/ECMWFDATA 7.051 export FLEXPART_ROOT_SCRIPTS=${HOME} 52 # export ECMWFDATA=$FLEXPART_ROOT/ECMWFDATA$VERSION 53 53 # export PYTHONPATH=$ECMWFDATA/python 54 54 # export PATH=${PATH}:$ECMWFDATA/python … … 59 59 mkdir -p $FLEXPART_ROOT_SCRIPTS/ECMWFDATA$VERSION 60 60 cd $FLEXPART_ROOT_SCRIPTS/ECMWFDATA$VERSION # if FLEXPART_ROOT is not set this means cd to the home directory 61 tar -xvf $ SCRATCH/ECMWFDATA$VERSION.tar61 tar -xvf $HOME/ECMWFDATA$VERSION.tar 62 62 cd src 63 63 \rm *.o *.mod CONVERT2 -
python/compilejob.temp
rd69b677 refdb01a 25 25 26 26 set -x 27 export VERSION=7. 027 export VERSION=7.1 28 28 case $HOST in 29 29 *ecg*) … … 34 34 module load emos/437-r64 35 35 export FLEXPART_ROOT_SCRIPTS= 36 # export ECMWFDATA=$FLEXPART_ROOT/ECMWFDATA 7.036 # export ECMWFDATA=$FLEXPART_ROOT/ECMWFDATA$VERSION 37 37 # export PYTHONPATH=$ECMWFDATA/python 38 38 # export PATH=${PATH}:$ECMWFDATA/python … … 50 50 export SCRATCH=/scratch/ms/${GROUP}/${USER} 51 51 export FLEXPART_ROOT_SCRIPTS= 52 # export ECMWFDATA=$FLEXPART_ROOT/ECMWFDATA 7.052 # export ECMWFDATA=$FLEXPART_ROOT/ECMWFDATA$VERSION 53 53 # export PYTHONPATH=$ECMWFDATA/python 54 54 # export PATH=${PATH}:$ECMWFDATA/python … … 59 59 mkdir -p $FLEXPART_ROOT_SCRIPTS/ECMWFDATA$VERSION 60 60 cd $FLEXPART_ROOT_SCRIPTS/ECMWFDATA$VERSION # if FLEXPART_ROOT is not set this means cd to the home directory 61 tar -xvf $ SCRATCH/ECMWFDATA$VERSION.tar61 tar -xvf $HOME/ECMWFDATA$VERSION.tar 62 62 cd src 63 63 \rm *.o *.mod CONVERT2 -
python/getMARSdata.py
- Property mode changed from 100644 to 100755
r02c8c50 refdb01a 1 1 #!/usr/bin/env python 2 # 3 # This software is licensed under the terms of the Apache Licence Version 2.0 4 # which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. 5 # 6 # Functionality provided: Prepare input 3D-wind fields in hybrid coordinates + surface fields for FLEXPART runs 7 # 8 # Creation: October 2014 - Anne Fouilloux - University of Oslo 9 # Extension November 2015 - Leopold Haimberger - University of Vienna for: 10 # - using the WebAPI also for general MARS retrievals 11 # - job submission on ecgate and cca 12 # - job templates suitable for twice daily operational dissemination 13 # - dividing retrievals of longer periods into digestable chunks 14 # - retrieve also longer term forecasts, not only analyses and short term forecast data 15 # - conversion into GRIB2 16 # - conversion into .fp format for faster execution of FLEXPART 17 # 18 # 19 # Further documentation may be obtained from www.flexpart.eu 20 # 21 # Requirements: 22 # in addition to a standard python 2.6 or 2.7 installation the following packages need to be installed 23 # ECMWF WebMARS, gribAPI with python enabled, emoslib, ecaccess web toolkit, all available from https://software.ecmwf.int/ 24 # dateutils 25 # matplotlib (optional, for debugging) 26 # 27 # Get MARS GRIB fields from ECMWF for FLEXPART 28 # 29 30 #import socket 31 32 #hostname=socket.gethostname() 33 #ecapi= 'ecmwf' not in hostname 2 # -*- coding: utf-8 -*- 3 #************************************************************************ 4 # TODO AP 5 # - Change History ist nicht angepasst ans File! 6 # - add file description 7 #************************************************************************ 8 """ 9 @Author: Anne Fouilloux (University of Oslo) 10 11 @Date: October 2014 12 13 @ChangeHistory: 14 November 2015 - Leopold Haimberger (University of Vienna): 15 - using the WebAPI also for general MARS retrievals 16 - job submission on ecgate and cca 17 - job templates suitable for twice daily operational dissemination 18 - dividing retrievals of longer periods into digestable chunks 19 - retrieve also longer term forecasts, not only analyses and 20 short term forecast data 21 - conversion into GRIB2 22 - conversion into .fp format for faster execution of FLEXPART 23 24 February 2018 - Anne Philipp (University of Vienna): 25 - applied PEP8 style guide 26 - added documentation 27 - minor changes in programming style for consistence 28 29 @License: 30 (C) Copyright 2014-2018. 31 32 This software is licensed under the terms of the Apache Licence Version 2.0 33 which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. 34 35 @Requirements: 36 - A standard python 2.6 or 2.7 installation 37 - dateutils 38 - ECMWF specific packages, all available from https://software.ecmwf.int/ 39 ECMWF WebMARS, gribAPI with python enabled, emoslib and 40 ecaccess web toolkit 41 42 @Description: 43 Further documentation may be obtained from www.flexpart.eu. 44 45 """ 46 # ------------------------------------------------------------------------------ 47 # MODULES 48 # ------------------------------------------------------------------------------ 34 49 try: 35 50 ecapi=True … … 42 57 import datetime 43 58 import time 44 import os,glob,sys,inspect 45 #from string import strip 46 from argparse import ArgumentParser,ArgumentDefaultsHelpFormatter 59 import os 60 import glob 61 import sys 62 import inspect 47 63 # add path to submit.py to pythonpath so that python finds its buddies 48 64 localpythonpath=os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) … … 50 66 sys.path.append(localpythonpath) 51 67 52 from FlexpartTools import ECFlexpart, \53 Control,myerror, normalexit, \68 from Control import Control 69 from Tools import myerror, normalexit, \ 54 70 interpret_args_and_control 55 56 71 from ECFlexpart import ECFlexpart 72 73 # ------------------------------------------------------------------------------ 74 # FUNCTION 75 # ------------------------------------------------------------------------------ 57 76 def getMARSdata(args, c): 58 77 … … 71 90 print 'ecapi:', c.ecapi 72 91 73 # Retrieve E RA interimdata for running flexpart92 # Retrieve EC data for running flexpart 74 93 #AP change this variant to correct format conversion with datetime 75 94 #AP import datetime and timedelta explicitly … … 81 100 if c.basetime == '00': 82 101 start = startm1 102 83 103 eyear = int(c.end_date[:4]) 84 104 emonth = int(c.end_date[4:6]) … … 91 111 92 112 datechunk = datetime.timedelta(days=int(c.date_chunk)) 113 114 # retrieving of accumulated data fields (flux data), (maximum one month) 115 116 # remove old files 93 117 print 'removing content of ' + c.inputdir 94 tobecleaned = glob.glob(c.inputdir + '/*_acc_*.' + str(os.getppid()) + '.*.grb') 118 tobecleaned = glob.glob(c.inputdir + '/*_acc_*.' + \ 119 str(os.getppid()) + '.*.grb') 95 120 for f in tobecleaned: 96 121 os.remove(f) 97 122 98 times=None 99 if c.maxstep<24: 100 day=startm1 101 while day<endp1: 102 # we need to retrieve MARS data for this period (maximum one month) 103 flexpart = ECFlexpart(c,fluxes=True) 104 if day+datechunk-datetime.timedelta(days=1)<endp1: 105 dates= day.strftime("%Y%m%d") + "/to/" + (day+datechunk-datetime.timedelta(days=1)).strftime("%Y%m%d") 123 times = None 124 # if forecast for maximum one day (upto 23h) are to be retrieved, 125 # collect accumulation data (flux data) 126 # with additional days in the beginning and at the end 127 # (used for complete disaggregation of original period) 128 if c.maxstep < 24: 129 day = startm1 130 while day < endp1: 131 # retrieve MARS data for the whole period 132 flexpart = ECFlexpart(c, fluxes=True) 133 tmpday = day + datechunk - datetime.timedelta(days=1) 134 if tmpday < endp1: 135 dates = day.strftime("%Y%m%d") + "/to/" + \ 136 tmpday.strftime("%Y%m%d") 106 137 else: 107 dates= day.strftime("%Y%m%d") + "/to/" + end.strftime("%Y%m%d") 138 dates = day.strftime("%Y%m%d") + "/to/" + \ 139 end.strftime("%Y%m%d") 108 140 109 141 print "retrieve " + dates + " in dir " + c.inputdir 142 110 143 try: 111 144 flexpart.retrieve(server, dates, times, c.inputdir) … … 113 146 myerror(c,'MARS request failed') 114 147 115 day+=datechunk 148 day += datechunk 149 150 # if forecast data longer than 24h are to be retrieved, 151 # collect accumulation data (flux data) 152 # with the exact start and end date 153 # (disaggregation will be done for the 154 # exact time period with boundary conditions) 116 155 else: 117 day=start 118 while day<=end: 119 # we need to retrieve MARS data for this period (maximum one month) 120 flexpart = ECFlexpart(c,fluxes=True) 121 if day+datechunk-datetime.timedelta(days=1)<end: 122 dates= day.strftime("%Y%m%d") + "/to/" + (day+datechunk-datetime.timedelta(days=1)).strftime("%Y%m%d") 156 day = start 157 while day <= end: 158 # retrieve MARS data for the whole period 159 flexpart = ECFlexpart(c, fluxes=True) 160 tmpday = day + datechunk - datetime.timedelta(days=1) 161 if tmpday < end: 162 dates = day.strftime("%Y%m%d") + "/to/" + \ 163 tmpday.trftime("%Y%m%d") 123 164 else: 124 dates= day.strftime("%Y%m%d") + "/to/" + end.strftime("%Y%m%d") 165 dates = day.strftime("%Y%m%d") + "/to/" + \ 166 end.strftime("%Y%m%d") 125 167 126 168 print "retrieve " + dates + " in dir " + c.inputdir 127 flexpart.retrieve(server, dates, times, c.inputdir) 128 day+=datechunk 129 130 131 132 tobecleaned=glob.glob(c.inputdir+'/*__*.'+str(os.getppid())+'.*.grb') 169 170 try: 171 flexpart.retrieve(server, dates, times, c.inputdir) 172 except IOError: 173 myerror(c, 'MARS request failed') 174 175 day += datechunk 176 177 # retrieving of normal data fields (non flux data), (maximum one month) 178 179 # remove old *__* files 180 tobecleaned = glob.glob(c.inputdir + '/*__*.' + 181 str(os.getppid()) + '.*.grb') 133 182 for f in tobecleaned: 134 183 os.remove(f) 135 day=start 136 times=None 137 while day<=end: 138 139 # we need to retrieve MARS data for this period (maximum one month) 140 flexpart = ECFlexpart(c) 141 if day+datechunk-datetime.timedelta(days=1)<end: 142 dates= day.strftime("%Y%m%d") + "/to/" + (day+datechunk-datetime.timedelta(days=1)).strftime("%Y%m%d") 184 day = start 185 times = None 186 while day <= end: 187 # retrieve MARS data for the whole period 188 flexpart = ECFlexpart(c, fluxes=False) 189 tmpday = day+datechunk-datetime.timedelta(days=1) 190 if tmpday < end: 191 dates = day.strftime("%Y%m%d") + "/to/" + \ 192 tmpday.strftime("%Y%m%d") 143 193 else: 144 dates= day.strftime("%Y%m%d") + "/to/" + end.strftime("%Y%m%d") 194 dates = day.strftime("%Y%m%d") + "/to/" + \ 195 end.strftime("%Y%m%d") 196 145 197 print "retrieve " + dates + " in dir " + c.inputdir 146 198 147 flexpart.retrieve(server, dates, times, c.inputdir) 148 day+=datechunk 149 199 try: 200 flexpart.retrieve(server, dates, times, c.inputdir) 201 except IOError: 202 myerror(c, 'MARS request failed') 203 204 day += datechunk 205 206 return 150 207 151 208 if __name__ == "__main__": 152 209 153 args, c=interpret_args_and_control()154 getMARSdata(args, c)210 args, c = interpret_args_and_control() 211 getMARSdata(args, c) 155 212 normalexit(c) -
python/install.py
- Property mode changed from 100644 to 100755
r02c8c50 refdb01a 64 64 localpythonpath=os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) 65 65 sys.path.append(localpythonpath) 66 from UIO Tools import UIOFiles66 from UIOFiles import UIOFiles 67 67 from string import strip 68 68 from argparse import ArgumentParser,ArgumentDefaultsHelpFormatter 69 69 from GribTools import GribTools 70 from FlexpartTools import ECFlexpart, Control, install_args_and_control70 from Control import Control 71 71 from getMARSdata import getMARSdata 72 72 from prepareFLEXPART import prepareFLEXPART 73 from ECFlexpart import ECFlexpart 73 74 74 75 # ------------------------------------------------------------------------------ 75 76 # FUNCTIONS 76 77 # ------------------------------------------------------------------------------ 78 def install_args_and_control(): 79 ''' 80 @Description: 81 Assigns the command line arguments for installation and reads 82 control file content. Apply default values for non mentioned arguments. 83 84 @Input: 85 <nothing> 86 87 @Return: 88 args: instance of ArgumentParser 89 Contains the commandline arguments from script/program call. 90 91 c: instance of class Control 92 Contains all necessary information of a control file. The parameters 93 are: DAY1, DAY2, DTIME, MAXSTEP, TYPE, TIME, STEP, CLASS, STREAM, 94 NUMBER, EXPVER, GRID, LEFT, LOWER, UPPER, RIGHT, LEVEL, LEVELIST, 95 RESOL, GAUSS, ACCURACY, OMEGA, OMEGADIFF, ETA, ETADIFF, DPDETA, 96 SMOOTH, FORMAT, ADDPAR, WRF, CWC, PREFIX, ECSTORAGE, ECTRANS, 97 ECFSDIR, MAILOPS, MAILFAIL, GRIB2FLEXPART, FLEXPARTDIR 98 For more information about format and content of the parameter see 99 documentation. 100 ''' 101 parser = ArgumentParser(description='Install ECMWFDATA software locally or \ 102 on ECMWF machines', 103 formatter_class=ArgumentDefaultsHelpFormatter) 104 105 parser.add_argument('--target', dest='install_target', 106 help="Valid targets: local | ecgate | cca , \ 107 the latter two are at ECMWF") 108 parser.add_argument("--makefile", dest="makefile", 109 help='Name of Makefile to use for compiling CONVERT2') 110 parser.add_argument("--ecuid", dest="ecuid", 111 help='user id at ECMWF') 112 parser.add_argument("--ecgid", dest="ecgid", 113 help='group id at ECMWF') 114 parser.add_argument("--gateway", dest="gateway", 115 help='name of local gateway server') 116 parser.add_argument("--destination", dest="destination", 117 help='ecaccess destination, e.g. leo@genericSftp') 118 119 parser.add_argument("--flexpart_root_scripts", dest="flexpart_root_scripts", 120 help="FLEXPART root directory on ECMWF servers \ 121 (to find grib2flexpart and COMMAND file)\n\ 122 Normally ECMWFDATA resides in the scripts directory \ 123 of the FLEXPART distribution, thus the:") 124 125 # arguments for job submission to ECMWF, only needed by submit.py 126 parser.add_argument("--job_template", dest='job_template', 127 default="job.temp.o", 128 help="job template file for submission to ECMWF") 129 130 parser.add_argument("--controlfile", dest="controlfile", 131 default='CONTROL.temp', 132 help="file with control parameters") 133 134 args = parser.parse_args() 135 136 try: 137 c = Control(args.controlfile) 138 except: 139 print('Could not read control file "' + args.controlfile + '"') 140 print('Either it does not exist or its syntax is wrong.') 141 print('Try "' + sys.argv[0].split('/')[-1] + 142 ' -h" to print usage information') 143 exit(1) 144 145 if args.install_target != 'local': 146 if (args.ecgid is None or args.ecuid is None or args.gateway is None 147 or args.destination is None): 148 print('Please enter your ECMWF user id and group id as well as \ 149 the \nname of the local gateway and the ectrans \ 150 destination ') 151 print('with command line options --ecuid --ecgid \ 152 --gateway --destination') 153 print('Try "' + sys.argv[0].split('/')[-1] + 154 ' -h" to print usage information') 155 print('Please consult ecaccess documentation or ECMWF user support \ 156 for further details') 157 sys.exit(1) 158 else: 159 c.ecuid = args.ecuid 160 c.ecgid = args.ecgid 161 c.gateway = args.gateway 162 c.destination = args.destination 163 164 try: 165 c.makefile = args.makefile 166 except: 167 pass 168 169 if args.install_target == 'local': 170 if args.flexpart_root_scripts is None: 171 c.flexpart_root_scripts = '../' 172 else: 173 c.flexpart_root_scripts = args.flexpart_root_scripts 174 175 if args.install_target != 'local': 176 if args.flexpart_root_scripts is None: 177 c.ec_flexpart_root_scripts = '${HOME}' 178 else: 179 c.ec_flexpart_root_scripts = args.flexpart_root_scripts 180 181 return args, c 182 183 77 184 def main(): 78 185 ''' … … 139 246 c.ecuid + 'flex_ecmwf.$Jobname.$Job_ID.out' 140 247 if 'export PATH=${PATH}:' in data: 141 data += c.ec_flexpart_root_scripts + '/ECMWFDATA7. 0/python'248 data += c.ec_flexpart_root_scripts + '/ECMWFDATA7.1/python' 142 249 if 'cat>>' in data or 'cat >>' in data: 143 250 i = data.index('>') … … 171 278 os.chdir('/') 172 279 p = subprocess.check_call(['tar', '-cvf', 173 ecd + '../ECMWFDATA7. 0.tar',280 ecd + '../ECMWFDATA7.1.tar', 174 281 ecd + 'python', 175 282 ecd + 'grib_templates', 176 283 ecd + 'src']) 177 284 try: 178 os.makedirs(c.flexpart_root_scripts + '/ECMWFDATA7. 0')285 os.makedirs(c.flexpart_root_scripts + '/ECMWFDATA7.1') 179 286 except: 180 287 pass 181 os.chdir(c.flexpart_root_scripts + '/ECMWFDATA7. 0')288 os.chdir(c.flexpart_root_scripts + '/ECMWFDATA7.1') 182 289 p = subprocess.check_call(['tar', '-xvf', 183 ecd + '../ECMWFDATA7. 0.tar'])184 os.chdir(c.flexpart_root_scripts + '/ECMWFDATA7. 0/src')290 ecd + '../ECMWFDATA7.1.tar']) 291 os.chdir(c.flexpart_root_scripts + '/ECMWFDATA7.1/src') 185 292 186 293 os.chdir('../src') 187 print(('install ECMWFDATA7. 0software on ' + target + ' in directory '294 print(('install ECMWFDATA7.1 software on ' + target + ' in directory ' 188 295 + os.getcwd())) 189 296 if c.makefile is None: … … 197 304 print(('Using makefile: ' + makefile)) 198 305 p = subprocess.check_call(['make', '-f', makefile]) 199 p = subprocess.check_call(['ls', '-l',' 306 p = subprocess.check_call(['ls', '-l','CONVERT2']) 200 307 except: 201 308 print('compile failed - please edit ' + makefile + 202 309 ' or try another Makefile in the src directory.') 203 print('most likely GRIB_API_INCLUDE_DIR, GRIB_API_LIB \204 and EMOSLIB must be adapted.')310 print('most likely GRIB_API_INCLUDE_DIR, GRIB_API_LIB ' 311 'and EMOSLIB must be adapted.') 205 312 print('Available Makefiles:') 206 313 print(glob.glob('Makefile*')) … … 209 316 os.chdir('/') 210 317 p = subprocess.check_call(['tar', '-cvf', 211 ecd + '../ECMWFDATA7. 0.tar',318 ecd + '../ECMWFDATA7.1.tar', 212 319 ecd + 'python', 213 320 ecd + 'grib_templates', … … 215 322 try: 216 323 p = subprocess.check_call(['ecaccess-file-put', 217 ecd + '../ECMWFDATA7. 0.tar',218 'ecgate:/ scratch/ms/' + c.ecgid + '/' +219 c.ecuid + '/ECMWFDATA7. 0.tar'])324 ecd + '../ECMWFDATA7.1.tar', 325 'ecgate:/home/ms/' + c.ecgid + '/' + 326 c.ecuid + '/ECMWFDATA7.1.tar']) 220 327 except: 221 328 print('ecaccess-file-put failed! Probably the eccert key has expired.') … … 225 332 target, 226 333 ecd + 'python/compilejob.ksh']) 227 print('compilejob.ksh has been submitted to ecgate for \228 installation in ' + c.ec_flexpart_root_scripts +229 '/ECMWFDATA7. 0')230 print('You should get an email with subject flexcompile within \231 the next few minutes')334 print('compilejob.ksh has been submitted to ecgate for ' 335 'installation in ' + c.ec_flexpart_root_scripts + 336 '/ECMWFDATA7.1') 337 print('You should get an email with subject flexcompile within ' 338 'the next few minutes') 232 339 233 340 elif target.lower() == 'cca': 234 341 os.chdir('/') 235 342 p = subprocess.check_call(['tar', '-cvf', 236 ecd + '../ECMWFDATA7. 0.tar',343 ecd + '../ECMWFDATA7.1.tar', 237 344 ecd + 'python', 238 345 ecd + 'grib_templates', … … 240 347 try: 241 348 p = subprocess.check_call(['ecaccess-file-put', 242 ecd + '../ECMWFDATA7. 0.tar',243 'cca:/ scratch/ms/' + c.ecgid + '/' +244 c.ecuid + '/ECMWFDATA7. 0.tar'])349 ecd + '../ECMWFDATA7.1.tar', 350 'cca:/home/ms/' + c.ecgid + '/' + 351 c.ecuid + '/ECMWFDATA7.1.tar']) 245 352 except: 246 print('ecaccess-file-put failed! \247 Probably the eccert key has expired.')353 print('ecaccess-file-put failed! ' 354 'Probably the eccert key has expired.') 248 355 exit(1) 249 356 … … 251 358 '-queueName', 252 359 target, 253 ecd + 'python/compilejob.ksh']) )360 ecd + 'python/compilejob.ksh']) 254 361 print('compilejob.ksh has been submitted to cca for installation in ' + 255 c.ec_flexpart_root_scripts + '/ECMWFDATA7. 0')256 print('You should get an email with subject flexcompile \257 within the next few minutes')362 c.ec_flexpart_root_scripts + '/ECMWFDATA7.1') 363 print('You should get an email with subject flexcompile ' 364 'within the next few minutes') 258 365 259 366 else: -
python/job.ksh
rd69b677 refdb01a 5 5 # start with sbatch NAME_OF_THIS_FILE directly on machine 6 6 7 #SBATCH --workdir=/scratch/ms/ spatlh00/lh07 #SBATCH --workdir=/scratch/ms/at/km4a 8 8 #SBATCH --qos=normal 9 9 #SBATCH --job-name=flex_ecmwf … … 25 25 26 26 set -x 27 27 export VERSION=7.1 28 28 case $HOST in 29 29 *ecg*) … … 33 33 module load grib_api/1.14.5 34 34 module load emos/437-r64 35 # export ECMWFDATA=$HOME/ECMWFDATA 7.035 # export ECMWFDATA=$HOME/ECMWFDATA$VERSION 36 36 # export PYTHONPATH=$ECMWFDATA/python 37 export PATH=${PATH}:${HOME}/ECMWFDATA7. 0/python37 export PATH=${PATH}:${HOME}/ECMWFDATA7.1/python 38 38 ;; 39 39 *cca*) … … 43 43 module load python 44 44 export SCRATCH=$TMPDIR 45 # export ECMWFDATA=$HOME/ECMWFDATA 7.045 # export ECMWFDATA=$HOME/ECMWFDATA$VERSION 46 46 # export PYTHONPATH=$ECMWFDATA/python 47 export PATH=${PATH}:${HOME}/ECMWFDATA7. 0/python47 export PATH=${PATH}:${HOME}/ECMWFDATA7.1/python 48 48 ;; 49 49 # *) 50 # export ECMWFDATA=$HOME/ECMWFDATA 7.050 # export ECMWFDATA=$HOME/ECMWFDATA$VERSION 51 51 # export PATH=/opt/anaconda/bin:$ECMWFDATA/python:${PATH} 52 52 # export PYTHONPATH=/opt/anaconda/lib/python2.7/site-packages/grib_api:$ECMWFDATA/python … … 63 63 64 64 cat >$CONTROL<<EOF 65 GATEWAY srvx 7.img.univie.ac.at66 DESTINATION leo@genericSftp65 GATEWAY srvx8.img.univie.ac.at 66 DESTINATION philipa8@genericSftp 67 67 accuracy 16 68 68 addpar 186 187 188 235 139 39 … … 74 74 dtime 3 75 75 ecfsdir ectmp:/${USER}/econdemand/ 76 ecstorage 176 ecstorage 0 77 77 ectrans 0 78 end_date 201 3110778 end_date 20160809 79 79 eta 0 80 80 etadiff 0 … … 85 85 grid 5000 86 86 inputdir ../work 87 left -1 7500087 left -15000 88 88 level 60 89 levelist 1/to/6090 lower -9000089 levelist 55/to/60 90 lower 30000 91 91 mailfail ${USER} 92 92 mailops ${USER} … … 98 98 omegadiff 0 99 99 outputdir ../work 100 prefix E N100 prefix EI 101 101 resol 63 102 right 180000102 right 45000 103 103 smooth 0 104 start_date 201 31107104 start_date 20160809 105 105 step 00 01 02 03 04 05 00 07 08 09 10 11 00 01 02 03 04 05 00 07 08 09 10 11 106 106 stream OPER 107 107 time 00 00 00 00 00 00 06 00 00 00 00 00 12 12 12 12 12 12 18 12 12 12 12 12 108 108 type AN FC FC FC FC FC AN FC FC FC FC FC AN FC FC FC FC FC AN FC FC FC FC FC 109 upper 90000109 upper 75000 110 110 EOF 111 111 112 112 113 submit.py --controlfile=$CONTROL --inputdir=./work --outputdir=./work >prot113 submit.py --controlfile=$CONTROL --inputdir=./work --outputdir=./work 1> prot 2>&1 114 114 115 115 if [ $? -eq 0 ] ; then -
python/job.temp
rd69b677 refdb01a 5 5 # start with sbatch NAME_OF_THIS_FILE directly on machine 6 6 7 #SBATCH --workdir=/scratch/ms/ spatlh00/lh07 #SBATCH --workdir=/scratch/ms/at/km4a 8 8 #SBATCH --qos=normal 9 9 #SBATCH --job-name=flex_ecmwf … … 25 25 26 26 set -x 27 27 export VERSION=7.1 28 28 case $HOST in 29 29 *ecg*) … … 33 33 module load grib_api/1.14.5 34 34 module load emos/437-r64 35 # export ECMWFDATA=$HOME/ECMWFDATA 7.035 # export ECMWFDATA=$HOME/ECMWFDATA$VERSION 36 36 # export PYTHONPATH=$ECMWFDATA/python 37 export PATH=${PATH}:${HOME}/ECMWFDATA7. 0/python37 export PATH=${PATH}:${HOME}/ECMWFDATA7.1/python 38 38 ;; 39 39 *cca*) … … 43 43 module load python 44 44 export SCRATCH=$TMPDIR 45 # export ECMWFDATA=$HOME/ECMWFDATA 7.045 # export ECMWFDATA=$HOME/ECMWFDATA$VERSION 46 46 # export PYTHONPATH=$ECMWFDATA/python 47 export PATH=${PATH}:${HOME}/ECMWFDATA7. 0/python47 export PATH=${PATH}:${HOME}/ECMWFDATA7.1/python 48 48 ;; 49 49 # *) 50 # export ECMWFDATA=$HOME/ECMWFDATA 7.050 # export ECMWFDATA=$HOME/ECMWFDATA$VERSION 51 51 # export PATH=/opt/anaconda/bin:$ECMWFDATA/python:${PATH} 52 52 # export PYTHONPATH=/opt/anaconda/lib/python2.7/site-packages/grib_api:$ECMWFDATA/python … … 63 63 64 64 cat >$CONTROL<<EOF 65 GATEWAY srvx 7.img.univie.ac.at66 DESTINATION leo@genericSftp65 GATEWAY srvx8.img.univie.ac.at 66 DESTINATION philipa8@genericSftp 67 67 EOF 68 68 cat >>$CONTROL<<EOF … … 70 70 71 71 72 submit.py --controlfile=$CONTROL --inputdir=./work --outputdir=./work >prot72 submit.py --controlfile=$CONTROL --inputdir=./work --outputdir=./work 1> prot 2>&1 73 73 74 74 if [ $? -eq 0 ] ; then -
python/job.temp.o
rd69b677 refdb01a 25 25 26 26 set -x 27 27 export VERSION=7.1 28 28 case $HOST in 29 29 *ecg*) … … 33 33 module load grib_api/1.14.5 34 34 module load emos/437-r64 35 # export ECMWFDATA=$HOME/ECMWFDATA 7.035 # export ECMWFDATA=$HOME/ECMWFDATA$VERSION 36 36 # export PYTHONPATH=$ECMWFDATA/python 37 37 export PATH=${PATH}: … … 43 43 module load python 44 44 export SCRATCH=$TMPDIR 45 # export ECMWFDATA=$HOME/ECMWFDATA 7.045 # export ECMWFDATA=$HOME/ECMWFDATA$VERSION 46 46 # export PYTHONPATH=$ECMWFDATA/python 47 47 export PATH=${PATH}: 48 48 ;; 49 49 # *) 50 # export ECMWFDATA=$HOME/ECMWFDATA 7.050 # export ECMWFDATA=$HOME/ECMWFDATA$VERSION 51 51 # export PATH=/opt/anaconda/bin:$ECMWFDATA/python:${PATH} 52 52 # export PYTHONPATH=/opt/anaconda/lib/python2.7/site-packages/grib_api:$ECMWFDATA/python … … 66 66 67 67 68 submit.py --controlfile=$CONTROL --inputdir=./work --outputdir=./work >prot68 submit.py --controlfile=$CONTROL --inputdir=./work --outputdir=./work 1> prot 2>&1 69 69 70 70 if [ $? -eq 0 ] ; then -
python/joboper.ksh
rd69b677 refdb01a 5 5 # start with sbatch NAME_OF_THIS_FILE directly on machine 6 6 7 #SBATCH --workdir=/scratch/ms/ spatlh00/lh07 #SBATCH --workdir=/scratch/ms/at/km4a 8 8 #SBATCH --qos=normal 9 9 #SBATCH --job-name=flex_ecmwf … … 25 25 26 26 set -x 27 27 export VERSION=7.1 28 28 case $HOST in 29 29 *ecg*) … … 33 33 module load grib_api/1.14.5 34 34 module load emos/437-r64 35 # export ECMWFDATA=$HOME/ECMWFDATA 7.035 # export ECMWFDATA=$HOME/ECMWFDATA$VERSION 36 36 # export PYTHONPATH=$ECMWFDATA/python 37 export PATH=${PATH}:${HOME}/ECMWFDATA7. 0/python37 export PATH=${PATH}:${HOME}/ECMWFDATA7.1/python 38 38 ;; 39 39 *cca*) … … 43 43 module load python 44 44 export SCRATCH=$TMPDIR 45 # export ECMWFDATA=$HOME/ECMWFDATA 7.045 # export ECMWFDATA=$HOME/ECMWFDATA$VERSION 46 46 # export PYTHONPATH=$ECMWFDATA/python 47 export PATH=${PATH}:${HOME}/ECMWFDATA7. 0/python47 export PATH=${PATH}:${HOME}/ECMWFDATA7.1/python 48 48 ;; 49 49 # *) 50 # export ECMWFDATA=$HOME/ECMWFDATA 7.050 # export ECMWFDATA=$HOME/ECMWFDATA$VERSION 51 51 # export PATH=/opt/anaconda/bin:$ECMWFDATA/python:${PATH} 52 52 # export PYTHONPATH=/opt/anaconda/lib/python2.7/site-packages/grib_api:$ECMWFDATA/python … … 63 63 64 64 cat >$CONTROL<<EOF 65 GATEWAY srvx 7.img.univie.ac.at66 DESTINATION leo@genericSftp65 GATEWAY srvx8.img.univie.ac.at 66 DESTINATION philipa8@genericSftp 67 67 accuracy 16 68 68 addpar 186 187 188 235 139 39 … … 74 74 dtime 3 75 75 ecfsdir ectmp:/${USER}/econdemand/ 76 ecstorage 176 ecstorage 0 77 77 ectrans 0 78 78 start_date ${MSJ_YEAR}${MSJ_MONTH}${MSJ_DAY} … … 85 85 grid 5000 86 86 inputdir ../work 87 left -1 7500087 left -15000 88 88 level 60 89 levelist 1/to/6090 lower -9000089 levelist 55/to/60 90 lower 30000 91 91 mailfail ${USER} 92 92 mailops ${USER} … … 98 98 omegadiff 0 99 99 outputdir ../work 100 prefix E N100 prefix EI 101 101 resol 63 102 right 180000102 right 45000 103 103 smooth 0 104 104 start_date ${MSJ_YEAR}${MSJ_MONTH}${MSJ_DAY} … … 107 107 time 00 00 00 00 00 00 06 00 00 00 00 00 12 12 12 12 12 12 18 12 12 12 12 12 108 108 type AN FC FC FC FC FC AN FC FC FC FC FC AN FC FC FC FC FC AN FC FC FC FC FC 109 upper 90000109 upper 75000 110 110 EOF 111 111 112 112 113 submit.py --controlfile=$CONTROL --inputdir=./work --outputdir=./work >prot113 submit.py --controlfile=$CONTROL --inputdir=./work --outputdir=./work 1> prot 2>&1 114 114 115 115 if [ $? -eq 0 ] ; then -
python/plot_retrieved.py
- Property mode changed from 100644 to 100755
r64cf353 refdb01a 30 30 from argparse import ArgumentParser,ArgumentDefaultsHelpFormatter 31 31 32 from FlexpartTools import interpret_args_and_control,silentremove,product,Control 32 from Tools import interpret_args_and_control, silentremove, product 33 from Control import Control 33 34 from GribTools import GribTools 34 35 from gribapi import * -
python/prepareFLEXPART.py
- Property mode changed from 100644 to 100755
r02c8c50 refdb01a 30 30 - added documentation 31 31 - minor changes in programming style for consistence 32 - BUG: removed call of cleanup-Function after call of prepareFlexpart 33 since it is already called in prepareFlexpart at the end! 32 34 33 35 @License: 34 (C) Copyright 2014 .36 (C) Copyright 2014-2018. 35 37 36 38 This software is licensed under the terms of the Apache Licence Version 2.0 … … 40 42 - A standard python 2.6 or 2.7 installation 41 43 - dateutils 42 - matplotlib (optional, for debugging)43 44 - ECMWF specific packages, all available from https://software.ecmwf.int/ 44 45 ECMWF WebMARS, gribAPI with python enabled, emoslib and … … 52 53 surface fields for FLEXPART runs 53 54 """ 54 55 # ------------------------------------------------------------------------------ 56 # MODULES 57 # ------------------------------------------------------------------------------ 55 58 import calendar 56 59 import shutil 57 60 import datetime 58 61 import time 59 import os,inspect,sys 62 import os 63 import inspect 64 import sys 60 65 import socket 61 66 from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter 62 # add path to submit.py to pythonpath so that python finds its buddies 63 localpythonpath=os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) 64 if localpythonpath not in sys.path: 65 sys.path.append(localpythonpath) 66 from UIOTools import UIOFiles 67 #from string import strip 68 from GribTools import GribTools 69 from FlexpartTools import ECFlexpart, Control, interpret_args_and_control, cleanup 67 import UIOFiles 68 import Control 69 import Tools 70 import ECFlexpart 70 71 71 hostname=socket.gethostname() 72 ecapi= 'ecmwf' not in hostname 73 72 hostname = socket.gethostname() 73 ecapi = 'ecmwf' not in hostname 74 74 try: 75 75 if ecapi: … … 78 78 ecapi = False 79 79 80 80 # add path to submit.py to pythonpath so that python finds its buddies 81 localpythonpath=os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) 82 if localpythonpath not in sys.path: 83 sys.path.append(localpythonpath) 84 # ------------------------------------------------------------------------------ 85 # FUNCTION 86 # ------------------------------------------------------------------------------ 81 87 def prepareFLEXPART(args, c): 82 88 ''' … … 121 127 day=int(c.end_date[6:])) 122 128 123 # to deaccumulate dthe fluxes correctly129 # to deaccumulate the fluxes correctly 124 130 # one day ahead of the start date and 125 131 # one day after the end date is needed … … 128 134 129 135 # get all files with flux data to be deaccumulated 130 inputfiles = UIOFiles (['.grib', '.grb', '.grib1',136 inputfiles = UIOFiles.UIOFiles(['.grib', '.grb', '.grib1', 131 137 '.grib2', '.grb1', '.grb2']) 132 138 … … 138 144 139 145 # deaccumulate the flux data 140 flexpart = ECFlexpart (c, fluxes=True)146 flexpart = ECFlexpart.ECFlexpart(c, fluxes=True) 141 147 flexpart.write_namelist(c, 'fort.4') 142 148 flexpart.deacc_fluxes(inputfiles, c) … … 146 152 147 153 # get a list of all files from the root inputdir 148 inputfiles = UIOFiles (['.grib', '.grb', '.grib1',154 inputfiles = UIOFiles.UIOFiles(['.grib', '.grb', '.grib1', 149 155 '.grib2', '.grb1', '.grb2']) 150 156 … … 157 163 start = startm1 158 164 159 flexpart = ECFlexpart (c, fluxes=False)165 flexpart = ECFlexpart.ECFlexpart(c, fluxes=False) 160 166 flexpart.create(inputfiles, c) 161 167 flexpart.process_output(c) 162 168 163 169 # check if in debugging mode, then store all files 170 # otherwise delete temporary files 164 171 if int(c.debug) != 0: 165 172 print('Temporary files left intact') 166 173 else: 167 cleanup(c)174 Tools.cleanup(c) 168 175 169 176 return 170 177 171 178 if __name__ == "__main__": 172 args, c = interpret_args_and_control()179 args, c = Tools.interpret_args_and_control() 173 180 prepareFLEXPART(args, c) 174 cleanup(c)175 -
python/submit.py
- Property mode changed from 100644 to 100755
r02c8c50 refdb01a 3 3 #************************************************************************ 4 4 # TODO AP 5 # AP5 # 6 6 # - Change History ist nicht angepasst ans File! Original geben lassen 7 7 # - dead code ? what to do? 8 8 # - seperate operational and reanlysis for clarification 9 # - add correct file description 10 # - divide in two submits , ondemand und operational 11 # - 9 12 #************************************************************************ 10 13 """ … … 15 18 @ChangeHistory: 16 19 November 2015 - Leopold Haimberger (University of Vienna): 17 - using the WebAPI also for general MARS retrievals18 20 - job submission on ecgate and cca 19 21 - job templates suitable for twice daily operational dissemination 20 - dividing retrievals of longer periods into digestable chunks21 - retrieve also longer term forecasts, not only analyses and22 short term forecast data23 - conversion into GRIB224 - conversion into .fp format for faster execution of FLEXPART25 22 26 23 February 2018 - Anne Philipp (University of Vienna): 27 24 - applied PEP8 style guide 28 25 - added documentation 29 - minor changes in programming style for consistence26 - minor changes in programming style (for consistence) 30 27 31 28 @License: 32 (C) Copyright 2014 UIO.29 (C) Copyright 2014-2018. 33 30 34 31 This software is licensed under the terms of the Apache Licence Version 2.0 … … 37 34 @Requirements: 38 35 - A standard python 2.6 or 2.7 installation 39 - dateutils40 - matplotlib (optional, for debugging)41 - ECMWF specific packages, all available from https://software.ecmwf.int/42 ECMWF WebMARS, gribAPI with python enabled, emoslib and43 ecaccess web toolkit44 36 45 37 @Description: 46 38 Further documentation may be obtained from www.flexpart.eu. 47 39 48 Functionality provided: 49 Prepare input 3D-wind fields in hybrid coordinates + 50 surface fields for FLEXPART runs 40 51 41 """ 52 42 # ------------------------------------------------------------------------------ 53 43 # MODULES 54 44 # ------------------------------------------------------------------------------ 55 import calendar 56 import shutil 57 import datetime 58 import time 59 import os, sys, glob 45 import os 46 import sys 47 import glob 60 48 import subprocess 61 49 import inspect 62 # add path to submit.py to pythonpath so that python finds its buddies50 # add the pythondir path so that python finds its buddies (from flex_extract) 63 51 localpythonpath = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) 64 52 sys.path.append(localpythonpath) 65 from UIOTools import UIOFiles 66 from string import strip 67 from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter 68 from GribTools import GribTools 69 from FlexpartTools import ECFlexpart, Control, interpret_args_and_control, normalexit, myerror 53 54 # software specific classes and modules from flex_extract 55 from Tools import interpret_args_and_control, normalexit 70 56 from getMARSdata import getMARSdata 71 57 from prepareFLEXPART import prepareFLEXPART … … 76 62 ''' 77 63 @Description: 78 Get the arguments from script call and initialize an object from 79 Control class. Decides from the argument "queue" if the local version 80 is done "queue=None" or the gateway version "queue=ecgate". 64 Get the arguments from script call and from Control file. 65 Decides from the argument "queue" if the local version 66 is done "queue=None" or the gateway version with "queue=ecgate" 67 or "queue=cca". 81 68 82 69 @Input: … … 88 75 calledfromdir = os.getcwd() 89 76 args, c = interpret_args_and_control() 77 # on local side 90 78 if args.queue is None: 91 79 if c.inputdir[0] != '/': … … 96 84 prepareFLEXPART(args, c) 97 85 normalexit(c) 86 # on ECMWF server 98 87 else: 99 88 submit(args.job_template, c, args.queue) … … 102 91 103 92 def submit(jtemplate, c, queue): 104 #AP divide in two submits , ondemand und operational105 93 ''' 106 94 @Description: … … 138 126 lftext = f.read().split('\n') 139 127 insert_point = lftext.index('EOF') 140 #AP es gibt mehrere EOFs überprüfen!141 128 142 129 # put all parameters of control instance into a list 143 clist = c.tolist() # reanalysis (EI)130 clist = c.tolist() 144 131 colist = [] # operational 145 132 mt = 0 146 133 147 134 #AP wieso 2 for loops? 148 #AP dieser part ist für die CTBTO Operational retrieves bis zum aktuellen Tag.149 135 for elem in clist: 150 136 if 'maxstep' in elem: … … 162 148 elem = 'time ' + '${MSJ_BASETIME} {MSJ_BASETIME}' 163 149 colist.append(elem) 164 #AP end165 166 #AP whats the difference between clist and colist ?! What is MSJ?167 150 168 151 lftextondemand = lftext[:insert_point] + clist + lftext[insert_point + 2:] … … 172 155 h.write('\n'.join(lftextondemand)) 173 156 174 #AP this is not used ?! what is it for? 175 #maybe a differentiation is needed 176 h = open('joboper.ksh', 'w') 177 h.write('\n'.join(lftextoper)) 178 h.close() 179 #AP end 157 with open('joboper.ksh', 'w') as h: 158 h.write('\n'.join(lftextoper)) 180 159 181 160 # submit job script to queue 182 161 try: 183 162 p = subprocess.check_call(['ecaccess-job-submit', '-queueName', 184 queue, 'job.ksh'])163 queue, 'job.ksh']) 185 164 except: 186 165 print('ecaccess-job-submit failed, probably eccert has expired') -
python/testsuite.py
- Property mode changed from 100644 to 100755
-
src/Makefile.local.ifort
rd69b677 refdb01a 12 12 13 13 14 GRIB_API_INCLUDE_DIR=/usr/local/ifort/grib _api-1.14.3//include15 GRIB_API_LIB=-openmp -L/usr/local/ifort/grib _api-1.14.3/lib -Bstatic -lgrib_api_f77 -lgrib_api_f90 -lgrib_api -Bdynamic -lm -ljasper #-lopenjpeg14 GRIB_API_INCLUDE_DIR=/usr/local/ifort/grib1.12.3//include 15 GRIB_API_LIB=-openmp -L/usr/local/ifort/grib1.12.3//lib -Bstatic -lgrib_api_f77 -lgrib_api_f90 -lgrib_api -Bdynamic -lm -ljasper #-lopenjpeg 16 16 17 17 OPT = -g
Note: See TracChangeset
for help on using the changeset viewer.