Changeset a9c7f3e in flex_extract.git
- Timestamp:
- Nov 26, 2018, 3:36:38 PM (5 years ago)
- Branches:
- master, ctbto, dev
- Children:
- fb8810c
- Parents:
- ceea034
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
python/FlexpartTools.py
r51f9853 ra9c7f3e 197 197 198 198 if c.request != '0': 199 marsfile = os.path.join(c.inputdir, 'mars_request .csv')199 marsfile = os.path.join(c.inputdir, 'mars_requests.csv') 200 200 if os.path.isfile(marsfile): 201 201 os.remove(marsfile) … … 578 578 if not hasattr(self,'request'): 579 579 self.request='0' 580 elif self.request != 0: 581 marsfile = os.path.join(self.inputdir, 582 'mars_requests.csv') 583 if os.path.isfile(marsfile): 584 silentremove(marsfile) 580 585 581 586 return … … 675 680 676 681 # Get all class attributes and their values as a dictionary 677 attrs = vars(self) 682 attrs = vars(self).copy() 678 683 del attrs['server'] 684 del attrs['public'] 679 685 680 686 # open a file to store all requests to 681 with open(os.path.join(inputdir, 'mars_request .csv'), 'a') as f:687 with open(os.path.join(inputdir, 'mars_requests.csv'), 'a') as f: 682 688 f.write(str(request_number) + ', ') 683 689 f.write(', '.join(str(attrs[key]) … … 1475 1481 for k in l: 1476 1482 key_vals.append(str(k)) 1477 1478 index_vals.append(key_vals)1483 1484 index_vals.append(key_vals) 1479 1485 1480 1486 -
python/getMARSdata.py
r51f9853 ra9c7f3e 58 58 if not os.path.exists(c.inputdir): 59 59 os.makedirs(c.inputdir) 60 61 62 if c.request == 0: 63 print("Retrieving EC data!") 64 else: 65 if c.request == 1: 66 print("Printing mars requests!") 67 elif c.request == 2: 68 print("Retrieving EC data and printing mars request!") 69 # first, write header with the mars parameter to file 70 # create a dummy MarsRetrieval to get parameter 71 MR = MARSretrieval(None, None) 72 attrs = vars(MR).copy() 73 del attrs['server'] 74 del attrs['public'] 75 marsfile = os.path.join(c.inputdir, 'mars_request.csv') 76 with open(marsfile, 'w') as f: 77 f.write('request_number' + ', ') 78 f.write(', '.join(str(key) for key in sorted(attrs.iterkeys()))) 79 f.write('\n') 80 60 81 print "start date %s "%(c.start_date) 61 82 print "end date %s "%(c.end_date) 62 63 if c.request == '0' or c.request == '2':64 print("Retrieving EC data!")65 elif c.request == '1':66 print("Printing mars requests!")67 83 68 84 if ecapi: … … 96 112 97 113 datechunk=datetime.timedelta(days=int(c.date_chunk)) 98 if c.request == '0' or c.request == '2': 114 if c.request == '0' or c.request == '2': 99 115 print 'removing content of '+c.inputdir 100 116 tobecleaned=glob.glob(c.inputdir+'/*_acc_*.'+str(os.getppid())+'.*.grb') … … 136 152 137 153 if c.request == '0' or c.request == '2': 138 print 'removing content of '+c.inputdir 154 print 'removing content of '+c.inputdir 139 155 tobecleaned=glob.glob(c.inputdir+'/*__*.'+str(os.getppid())+'.*.grb') 140 156 for f in tobecleaned: 141 157 os.remove(f) 142 158 143 159 day=start 144 160 times=None
Note: See TracChangeset
for help on using the changeset viewer.