Commit df7d7a8abeeb385568184748bd478bb6f7c402da

Authored by Michael Mayer
1 parent 982f4684

Corrected a problem causing an exception in case no runlist is given

Showing 1 changed file with 9 additions and 5 deletions
cscripts/csiactdload.py
@@ -388,13 +388,14 @@ class csiactdload(ctools.cscript): @@ -388,13 +388,14 @@ class csiactdload(ctools.cscript):
388 self.log("\n") 388 self.log("\n")
389 self.log.header1("Updating index files") 389 self.log.header1("Updating index files")
390 390
  391 + # Build local index file names
  392 + local_hdu = os.path.join(self.m_outpath, os.path.relpath(remote_hdu, self.remote_base))
  393 + local_obs = os.path.join(self.m_outpath, os.path.relpath(remote_obs, self.remote_base))
  394 +
391 # If we have a runlist then merge index file 395 # If we have a runlist then merge index file
392 if len(self.runlist): 396 if len(self.runlist):
393 397
394 - # Check if there are local index files  
395 - local_hdu = os.path.join(self.m_outpath,os.path.relpath(remote_hdu, self.remote_base))  
396 - local_obs = os.path.join(self.m_outpath,os.path.relpath(remote_obs, self.remote_base))  
397 - 398 + # Logging
398 if self.logTerse(): 399 if self.logTerse():
399 self.log("\n") 400 self.log("\n")
400 self.log.header3("HDU index") 401 self.log.header3("HDU index")
@@ -466,6 +467,9 @@ class csiactdload(ctools.cscript): @@ -466,6 +467,9 @@ class csiactdload(ctools.cscript):
466 newdict["hduindx"] = os.path.relpath(local_hdu, self.m_outpath) 467 newdict["hduindx"] = os.path.relpath(local_hdu, self.m_outpath)
467 newdict["obsindx"] = os.path.relpath(local_obs, self.m_outpath) 468 newdict["obsindx"] = os.path.relpath(local_obs, self.m_outpath)
468 newconfigs.append(newdict) 469 newconfigs.append(newdict)
  470 + if self.logTerse():
  471 + self.log("Adding \""+str(newdict["name"])+"\"")
  472 + self.log("\n")
469 473
470 # Write new json master file 474 # Write new json master file
471 f = open(localmaster, "w") 475 f = open(localmaster, "w")
@@ -506,7 +510,6 @@ class csiactdload(ctools.cscript): @@ -506,7 +510,6 @@ class csiactdload(ctools.cscript):
506 # Get file destination 510 # Get file destination
507 destination = os.path.join(self.m_outpath,os.path.relpath(source, self.remote_base)) 511 destination = os.path.join(self.m_outpath,os.path.relpath(source, self.remote_base))
508 512
509 -  
510 # Initialise return value 513 # Initialise return value
511 filesize = 0.0 514 filesize = 0.0
512 515
@@ -567,6 +570,7 @@ class csiactdload(ctools.cscript): @@ -567,6 +570,7 @@ class csiactdload(ctools.cscript):
567 def merge(self, localfits, remotefits, hduname, clobber): 570 def merge(self, localfits, remotefits, hduname, clobber):
568 """ 571 """
569 merge remote and local fits file 572 merge remote and local fits file
  573 + If local fits file not present, a new one is created
570 """ 574 """
571 575
572 if self.logTerse(): 576 if self.logTerse():