コード例 #1
0
    def initialize(self):

        # create date object
        self.date = pyDate.Date(year=self.options['year'],
                                doy=self.options['doy'])

        # check for pre-existing solution if lazy
        (solutionAlreadyExists,
         key) = Resources.soln_exists(self.date, self.options['expt'],
                                      self.options['org'],
                                      self.options['network_id'])

        if solutionAlreadyExists and self.isLazy:
            raise Processing.LazyException("file exists: " + key)

        # do all the program independent stuff
        super(Session, self).initialize()

        # get the resource bucket path
        bucket = self.get_resources_path()

        # get the apr file
        apr_file = glob.glob(os.path.join(bucket, '*.apr'))

        # yell about it if not found
        if len(apr_file) != 1:
            raise GamitException('problem identifying APR resources in ' +
                                 bucket)

        # create apr file
        wlapr2apr(os.path.join(bucket, apr_file[0]))

        # get the binaries for gamit
        self.files['bin'] = Resources.get_bin('gamit', self.work_dir_path)

        # get the tables for gamit
        self.files['tables'] = Resources.get_tables('gamit',
                                                    self.work_dir_path)

        # create custom setup shell script
        self.files['setup_script_path'] = self.__create_setup_script()

        # create custom run script
        self.files['run_script_path'] = self.__create_run_script()

        # create the custom cleanup script
        self.files['teardown_script_path'] = self.__create_teardown_script()
コード例 #2
0
ファイル: globk.py プロジェクト: softwarespartan/AGT
    def initialize(self):
        
        # no call to super.initialize().  just create work dir ourselves
        
        year = Utils.get_norm_year_str(self.options['year']);
        doy  = Utils.get_norm_doy_str( self.options['doy'] );
        
        # init date object
        date = pyDate.Date(year=year,doy=doy);

        # check for pre-existing solution if lazy
        (solutionAlreadyExists, key) = Resources.soln_exists(
            date,
            self.options['expt'],
            self.options['org'],
            self.options['network_id']
        )

        if solutionAlreadyExists and self.isLazy:
            raise Processing.LazyException("file exists: " + key)
        
        # make sure we have something specified to work with
        if len(self.src) == 0: 
            raise GlobkException('no src has been specified');
              
        # make sure that work directory has been initialized
        if not self.is_valid():
            raise GlobkException('invalid session state');    
         
        # make sure the the temporary directory does not already exist
        if os.path.isdir(self.work_dir_path):
            raise GlobkException(
                'temporary work directory '+self.work_dir_path+' already exists'
            );
        
        # attempt to create the work directory
        try:
            # make parent dirs also
            os.makedirs(self.work_dir_path    , 0755);
            os.makedirs(self.get_resources_path(), 0755);
        except Exception, e:
            
            # unsuccessful attempt
            raise GlobkException(str(e));
コード例 #3
0
ファイル: napeos.py プロジェクト: softwarespartan/AGT
    def initialize(self):

        # create date object
        self.date = pyDate.Date(year=self.options['year'], doy=self.options['doy'])

        # check for pre-existing solution if lazy
        (solutionAlreadyExists,key) = Resources.soln_exists(
                self.date,
                self.options['expt'],
                self.options['org'],
                self.options['network_id']
        )

        if solutionAlreadyExists and self.isLazy:
            raise Processing.LazyException("file exists: "+key)


        # do all the program independent stuff
        super(Session, self).initialize();


        # figure out which stations have APR
        stns_with_apr = self.get_stns_with_apr();

        # initialize DOMES for each station requested
        # note that site.dat, gps.apr, and D-file use only stns listed in domesMgr
        for stnid in self.stn_list:

            # if there is no APR then do not add to DOMES
            if not stnid in stns_with_apr:
                os.sys.stderr.write('excluding station not found in apr: %s\n'%stnid)
                continue

            # parse the station id
            (ns,code) = Utils.parse_stnId(stnid)

            # add the station to the domes mgr if it's not already defined
            if not self.domesMgr.containsStnId(code): self.domesMgr.addStn(code);

        # get the resource bucket path
        bucket = self.get_resources_path();

        apr_file_path = self.files['apr']

        # create gamit apr file for OTL computations
        gamit_apr_file_path = gamit.wlapr2apr(apr_file_path)

        # get the binaries for gamit (bin file path used by create_U_file)
        self.files['bin'] = Resources.get_bin('napeos', self.work_dir_path)

        # get the tables for gamit
        self.files['tables'] = Resources.get_tables('napeos', self.work_dir_path)

        # combine all of the station info files into single file
        gamit_station_info_file_path = self.concatonate_station_info_files()

        # convert the station info file into station.dat
        napeos_station_dat_file_path = self.convert_station_info_to_dat(gamit_station_info_file_path)

        # convert the generic agt apr file to napeos crd file
        napeos_crd_file_path = self.convert_apr_to_crd(apr_file_path)

        # create the site.dat file with domes numbers for each station
        napeos_site_dot_dat = self.create_site_dot_dat()

        napeos_BLQ_file_path = self.create_OTL_file(gamit_apr_file_path,self.domesMgr.stn_list())

        # clean up all this shit
        self.init_cleanup()

        # create the setup script for the job
        setup_script_file_path = self.create_setup_script()

        # create the run script for the job
        run_script_file_path = self.create_run_script()

        # create the teardown script for the job
        teardown_script_file_path = self.create_tear_down_script()