##// END OF EJS Templates
El envio de imagenes por ftp requiere de parametros: ftp_wei, exp_code, sub_exp_code, plot_pos, plot_code. Estos parametros se han actualizado en las funciones de ploteo.
Daniel Valdez -
r401:688a696fe4fd
parent child
Show More
@@ -166,11 +166,22 class Figure:
166 166
167 167 self.__driver.saveFigure(self.fig, filename, *args)
168 168
169 def sendByFTP(self, figfilename):
170 ftpObj = Ftp()
169 def sendByFTP(self, figfilename, server, folder, username, password):
170 ftpObj = Ftp(host=server, username=username, passw=password, remotefolder=folder)
171 171 ftpObj.upload(figfilename)
172 172 ftpObj.close()
173 173
174 def getNameToFtp(self, thisDatetime, FTP_WEI, EXP_CODE, SUB_EXP_CODE, PLOT_CODE, PLOT_POS):
175 YEAR_STR = '%4.4d'%thisDatetime.timetuple().tm_year
176 DOY_STR = '%3.3d'%thisDatetime.timetuple().tm_yday
177 FTP_WEI = '%2.2d'%FTP_WEI
178 EXP_CODE = '%3.3d'%EXP_CODE
179 SUB_EXP_CODE = '%2.2d'%SUB_EXP_CODE
180 PLOT_CODE = '%2.2d'%PLOT_CODE
181 PLOT_POS = '%2.2d'%PLOT_POS
182 name = YEAR_STR + DOY_STR + FTP_WEI + EXP_CODE + SUB_EXP_CODE + PLOT_CODE + PLOT_POS
183 return name
184
174 185 def draw(self):
175 186
176 187 self.__driver.draw(self.fig)
@@ -29,6 +29,12 class CrossSpectraPlot(Figure):
29 29 self.WIDTHPROF = 0
30 30 self.HEIGHTPROF = 0
31 31
32 self.PLOT_CODE = 1
33 self.FTP_WEI = None
34 self.EXP_CODE = None
35 self.SUB_EXP_CODE = None
36 self.PLOT_POS = None
37
32 38 def getSubplots(self):
33 39
34 40 ncol = 4
@@ -61,8 +67,10 class CrossSpectraPlot(Figure):
61 67
62 68 def run(self, dataOut, id, wintitle="", pairsList=None,
63 69 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
64 save=False, figpath='./', figfile=None, ftp=False, res_imagwr=1,
65 power_cmap='jet', coherence_cmap='jet', phase_cmap='RdBu_r', show=True):
70 save=False, figpath='./', figfile=None, ftp=False, wr_period=1,
71 power_cmap='jet', coherence_cmap='jet', phase_cmap='RdBu_r', show=True,
72 server=None, folder=None, username=None, password=None,
73 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
66 74
67 75 """
68 76
@@ -130,6 +138,11 class CrossSpectraPlot(Figure):
130 138 if zmin == None: zmin = numpy.nanmin(avgdB)*0.9
131 139 if zmax == None: zmax = numpy.nanmax(avgdB)*0.9
132 140
141 self.FTP_WEI = ftp_wei
142 self.EXP_CODE = exp_code
143 self.SUB_EXP_CODE = sub_exp_code
144 self.PLOT_POS = plot_pos
145
133 146 self.__isConfig = True
134 147
135 148 self.setWinTitle(title)
@@ -179,7 +192,7 class CrossSpectraPlot(Figure):
179 192 if save:
180 193
181 194 self.counter_imagwr += 1
182 if (self.counter_imagwr==res_imagwr):
195 if (self.counter_imagwr==wr_period):
183 196 if figfile == None:
184 197 str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S")
185 198 figfile = self.getFilename(name = str_datetime)
@@ -188,28 +201,20 class CrossSpectraPlot(Figure):
188 201
189 202 if ftp:
190 203 #provisionalmente envia archivos en el formato de la web en tiempo real
191 name = '%4d%3d00010001100'%(thisDatetime.timetuple().tm_year,thisDatetime.timetuple().tm_yday)
204 name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
192 205 path = '%s%03d' %(self.PREFIX, self.id)
193 206 ftp_file = os.path.join(path,'ftp','%s.png'%name)
194 207 self.saveFigure(figpath, ftp_file)
195 208 ftp_filename = os.path.join(figpath,ftp_file)
196 209
197 210 try:
198 self.sendByFTP(ftp_filename)
211 self.sendByFTP(ftp_filename, server, folder, username, password)
199 212 except:
200 213 raise ValueError, 'Error FTP'
201 214
202 215 self.counter_imagwr = 0
203 216
204 217
205 # if save:
206 # date = thisDatetime.strftime("%Y%m%d_%H%M%S")
207 # if figfile == None:
208 # figfile = self.getFilename(name = date)
209 #
210 # self.saveFigure(figpath, figfile)
211
212
213 218 class RTIPlot(Figure):
214 219
215 220 __isConfig = None
@@ -231,6 +236,12 class RTIPlot(Figure):
231 236 self.HEIGHTPROF = 0
232 237 self.counter_imagwr = 0
233 238
239 self.PLOT_CODE = 0
240 self.FTP_WEI = None
241 self.EXP_CODE = None
242 self.SUB_EXP_CODE = None
243 self.PLOT_POS = None
244
234 245 def getSubplots(self):
235 246
236 247 ncol = 1
@@ -275,7 +286,9 class RTIPlot(Figure):
275 286 def run(self, dataOut, id, wintitle="", channelList=None, showprofile='True',
276 287 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
277 288 timerange=None,
278 save=False, figpath='./', figfile=None, ftp=False, res_imagwr=1, show=True):
289 save=False, figpath='./', figfile=None, ftp=False, wr_period=1, show=True,
290 server=None, folder=None, username=None, password=None,
291 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
279 292
280 293 """
281 294
@@ -340,6 +353,11 class RTIPlot(Figure):
340 353 if zmin == None: zmin = numpy.nanmin(avgdB)*0.9
341 354 if zmax == None: zmax = numpy.nanmax(avgdB)*0.9
342 355
356 self.FTP_WEI = ftp_wei
357 self.EXP_CODE = exp_code
358 self.SUB_EXP_CODE = sub_exp_code
359 self.PLOT_POS = plot_pos
360
343 361 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
344 362 self.__isConfig = True
345 363
@@ -368,20 +386,20 class RTIPlot(Figure):
368 386 if save:
369 387
370 388 self.counter_imagwr += 1
371 if (self.counter_imagwr==res_imagwr):
389 if (self.counter_imagwr==wr_period):
372 390 if figfile == None:
373 391 figfile = self.getFilename(name = self.name)
374 392 self.saveFigure(figpath, figfile)
375 393
376 394 if ftp:
377 395 #provisionalmente envia archivos en el formato de la web en tiempo real
378 name = '%4d%3d00010000000'%(thisDatetime.timetuple().tm_year,thisDatetime.timetuple().tm_yday)
396 name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
379 397 path = '%s%03d' %(self.PREFIX, self.id)
380 398 ftp_file = os.path.join(path,'ftp','%s.png'%name)
381 399 self.saveFigure(figpath, ftp_file)
382 400 ftp_filename = os.path.join(figpath,ftp_file)
383 401 try:
384 self.sendByFTP(ftp_filename)
402 self.sendByFTP(ftp_filename, server, folder, username, password)
385 403 except:
386 404 raise ValueError, 'Error FTP'
387 405
@@ -410,6 +428,12 class SpectraPlot(Figure):
410 428 self.HEIGHTPROF = 0
411 429 self.counter_imagwr = 0
412 430
431 self.PLOT_CODE = 1
432 self.FTP_WEI = None
433 self.EXP_CODE = None
434 self.SUB_EXP_CODE = None
435 self.PLOT_POS = None
436
413 437 def getSubplots(self):
414 438
415 439 ncol = int(numpy.sqrt(self.nplots)+0.9)
@@ -451,9 +475,11 class SpectraPlot(Figure):
451 475
452 476 counter += 1
453 477
454 def run(self, dataOut, id, wintitle="", channelList=None, showprofile='True',
478 def run(self, dataOut, id, wintitle="", channelList=None, showprofile=True,
455 479 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
456 save=False, figpath='./', figfile=None, show=True, ftp=False, res_imagwr=1):
480 save=False, figpath='./', figfile=None, show=True, ftp=False, wr_period=1,
481 server=None, folder=None, username=None, password=None,
482 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
457 483
458 484 """
459 485
@@ -515,6 +541,11 class SpectraPlot(Figure):
515 541 if zmin == None: zmin = numpy.nanmin(avgdB)*0.9
516 542 if zmax == None: zmax = numpy.nanmax(avgdB)*0.9
517 543
544 self.FTP_WEI = ftp_wei
545 self.EXP_CODE = exp_code
546 self.SUB_EXP_CODE = sub_exp_code
547 self.PLOT_POS = plot_pos
548
518 549 self.__isConfig = True
519 550
520 551 self.setWinTitle(title)
@@ -544,7 +575,7 class SpectraPlot(Figure):
544 575 if save:
545 576
546 577 self.counter_imagwr += 1
547 if (self.counter_imagwr==res_imagwr):
578 if (self.counter_imagwr==wr_period):
548 579 if figfile == None:
549 580 str_datetime = thisDatetime.strftime("%Y%m%d_%H%M%S")
550 581 figfile = self.getFilename(name = str_datetime)
@@ -553,13 +584,13 class SpectraPlot(Figure):
553 584
554 585 if ftp:
555 586 #provisionalmente envia archivos en el formato de la web en tiempo real
556 name = '%4d%3d00010000100'%(thisDatetime.timetuple().tm_year,thisDatetime.timetuple().tm_yday)
587 name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
557 588 path = '%s%03d' %(self.PREFIX, self.id)
558 589 ftp_file = os.path.join(path,'ftp','%s.png'%name)
559 590 self.saveFigure(figpath, ftp_file)
560 591 ftp_filename = os.path.join(figpath,ftp_file)
561 592 try:
562 self.sendByFTP(ftp_filename)
593 self.sendByFTP(ftp_filename, server, folder, username, password)
563 594 except:
564 595 raise ValueError, 'Error FTP'
565 596
@@ -795,6 +826,13 class CoherenceMap(Figure):
795 826 self.HEIGHTPROF = 0
796 827 self.counter_imagwr = 0
797 828
829 self.PLOT_CODE = 3
830 self.FTP_WEI = None
831 self.EXP_CODE = None
832 self.SUB_EXP_CODE = None
833 self.PLOT_POS = None
834 self.counter_imagwr = 0
835
798 836 def getSubplots(self):
799 837 ncol = 1
800 838 nrow = self.nplots*2
@@ -831,8 +869,10 class CoherenceMap(Figure):
831 869 def run(self, dataOut, id, wintitle="", pairsList=None, showprofile='True',
832 870 xmin=None, xmax=None, ymin=None, ymax=None, zmin=None, zmax=None,
833 871 timerange=None,
834 save=False, figpath='./', figfile=None, ftp=False, res_imagwr=1,
835 coherence_cmap='jet', phase_cmap='RdBu_r', show=True):
872 save=False, figpath='./', figfile=None, ftp=False, wr_period=1,
873 coherence_cmap='jet', phase_cmap='RdBu_r', show=True,
874 server=None, folder=None, username=None, password=None,
875 ftp_wei=0, exp_code=0, sub_exp_code=0, plot_pos=0):
836 876
837 877 if pairsList == None:
838 878 pairsIndexList = dataOut.pairsIndexList
@@ -859,7 +899,7 class CoherenceMap(Figure):
859 899
860 900 #thisDatetime = dataOut.datatime
861 901 thisDatetime = datetime.datetime.utcfromtimestamp(dataOut.getTimeRange()[1])
862 title = wintitle + " CoherenceMap: %s" %(thisDatetime.strftime("%d-%b-%Y"))
902 title = wintitle + " CoherenceMap" #: %s" %(thisDatetime.strftime("%d-%b-%Y"))
863 903 xlabel = ""
864 904 ylabel = "Range (Km)"
865 905
@@ -877,6 +917,11 class CoherenceMap(Figure):
877 917 if zmin == None: zmin = 0.
878 918 if zmax == None: zmax = 1.
879 919
920 self.FTP_WEI = ftp_wei
921 self.EXP_CODE = exp_code
922 self.SUB_EXP_CODE = sub_exp_code
923 self.PLOT_POS = plot_pos
924
880 925 self.name = thisDatetime.strftime("%Y%m%d_%H%M%S")
881 926
882 927 self.__isConfig = True
@@ -939,20 +984,20 class CoherenceMap(Figure):
939 984 if save:
940 985
941 986 self.counter_imagwr += 1
942 if (self.counter_imagwr==res_imagwr):
987 if (self.counter_imagwr==wr_period):
943 988 if figfile == None:
944 989 figfile = self.getFilename(name = self.name)
945 990 self.saveFigure(figpath, figfile)
946 991
947 992 if ftp:
948 993 #provisionalmente envia archivos en el formato de la web en tiempo real
949 name = '%4d%3d00010001000'%(thisDatetime.timetuple().tm_year,thisDatetime.timetuple().tm_yday)
994 name = self.getNameToFtp(thisDatetime, self.FTP_WEI, self.EXP_CODE, self.SUB_EXP_CODE, self.PLOT_CODE, self.PLOT_POS)
950 995 path = '%s%03d' %(self.PREFIX, self.id)
951 996 ftp_file = os.path.join(path,'ftp','%s.png'%name)
952 997 self.saveFigure(figpath, ftp_file)
953 998 ftp_filename = os.path.join(figpath,ftp_file)
954 999 try:
955 self.sendByFTP(ftp_filename)
1000 self.sendByFTP(ftp_filename, server, folder, username, password)
956 1001 except:
957 1002 raise ValueError, 'Error FTP'
958 1003
@@ -1189,7 +1234,7 class SpectraHeisScope(Figure):
1189 1234
1190 1235 def run(self, dataOut, id, wintitle="", channelList=None,
1191 1236 xmin=None, xmax=None, ymin=None, ymax=None, save=False,
1192 figpath='./', figfile=None, ftp=False, res_imagwr=1, show=True):
1237 figpath='./', figfile=None, ftp=False, wr_period=1, show=True):
1193 1238
1194 1239 """
1195 1240
@@ -1271,7 +1316,7 class SpectraHeisScope(Figure):
1271 1316 self.saveFigure(figpath, figfile)
1272 1317
1273 1318 self.counter_imagwr += 1
1274 if (ftp and (self.counter_imagwr==res_imagwr)):
1319 if (ftp and (self.counter_imagwr==wr_period)):
1275 1320 figfilename = os.path.join(figpath,figfile)
1276 1321 self.sendByFTP(figfilename)
1277 1322 self.counter_imagwr = 0
@@ -1328,7 +1373,7 class RTIfromSpectraHeis(Figure):
1328 1373 def run(self, dataOut, id, wintitle="", channelList=None, showprofile='True',
1329 1374 xmin=None, xmax=None, ymin=None, ymax=None,
1330 1375 timerange=None,
1331 save=False, figpath='./', figfile=None, ftp=False, res_imagwr=1, show=True):
1376 save=False, figpath='./', figfile=None, ftp=False, wr_period=1, show=True):
1332 1377
1333 1378 if channelList == None:
1334 1379 channelIndexList = dataOut.channelIndexList
@@ -1416,7 +1461,7 class RTIfromSpectraHeis(Figure):
1416 1461 self.saveFigure(figpath, figfile)
1417 1462
1418 1463 self.counter_imagwr += 1
1419 if (ftp and (self.counter_imagwr==res_imagwr)):
1464 if (ftp and (self.counter_imagwr==wr_period)):
1420 1465 figfilename = os.path.join(figpath,figfile)
1421 1466 self.sendByFTP(figfilename)
1422 1467 self.counter_imagwr = 0
General Comments 0
You need to be logged in to leave comments. Login now