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 388 self.log("\n")
389 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 395 # If we have a runlist then merge index file
392 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 399 if self.logTerse():
399 400 self.log("\n")
400 401 self.log.header3("HDU index")
... ... @@ -466,6 +467,9 @@ class csiactdload(ctools.cscript):
466 467 newdict["hduindx"] = os.path.relpath(local_hdu, self.m_outpath)
467 468 newdict["obsindx"] = os.path.relpath(local_obs, self.m_outpath)
468 469 newconfigs.append(newdict)
  470 + if self.logTerse():
  471 + self.log("Adding \""+str(newdict["name"])+"\"")
  472 + self.log("\n")
469 473  
470 474 # Write new json master file
471 475 f = open(localmaster, "w")
... ... @@ -506,7 +510,6 @@ class csiactdload(ctools.cscript):
506 510 # Get file destination
507 511 destination = os.path.join(self.m_outpath,os.path.relpath(source, self.remote_base))
508 512  
509   -
510 513 # Initialise return value
511 514 filesize = 0.0
512 515  
... ... @@ -567,6 +570,7 @@ class csiactdload(ctools.cscript):
567 570 def merge(self, localfits, remotefits, hduname, clobber):
568 571 """
569 572 merge remote and local fits file
  573 + If local fits file not present, a new one is created
570 574 """
571 575  
572 576 if self.logTerse():
... ...