Changeset 17


Ignore:
Timestamp:
18/05/12 20:28:54 (8 years ago)
Author:
lalibert
Message:

Added a new variable CDB_YEARS_FIX_LIST in scripts to run the script for individual years

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CDB/trunk/driver/diag_driver_comp.py

    r1 r17  
    6060            out.writei('#PBS -e {5}/pbs_err/{0}_{1}_{2}_{3}_{4}\n'.format(self.years[0],self.years[1],self.model,self.run_id,self.experiment,self.source_dir)) 
    6161 
     62        out.writei('\n') 
     63        out.writei('#The next variable should be empty. If your script completed and some\n') 
     64        out.writei('#years did not process properly (usually due to a timeout on large\n') 
     65        out.writei('#storage systems), you can list the years (space separated)\n') 
     66        out.writei('#to recompute these years. Simply rerun or resubmit the scripts\n') 
     67        out.writei('CDB_YEARS_FIX_LIST=""\n'.format(self.years[0],self.years[1])) 
    6268        out.writei('\n') 
    6369        out.writei('CDB_YEARS={0},{1}\n'.format(self.years[0],self.years[1])) 
     
    122128                    out.writei('CDB_VAR_ATTRIBUTION=`bash $CDB_SOURCE_DIR/retrieval_script.sh -d ${CDB_DIAG_NAME} -v ${CDB_VAR_LIST} -m ${CDB_MODEL} -e ${CDB_EXPT} -r ${CDB_RUN_ID} -y ${CDB_YEAR}`\n') 
    123129                    out.writei('for CDB_VAR in ${CDB_VAR_ATTRIBUTION}; do eval ${CDB_VAR}; done\n') 
     130                    out.writei('#Previous year\n') 
     131                    out.writei('let "CDB_YEAR-=1"\n') 
     132                    out.writei('CDB_VAR_ATTRIBUTION=`bash $CDB_SOURCE_DIR/retrieval_script.sh -d ${CDB_DIAG_NAME} -v ${CDB_VAR_LIST} -m ${CDB_MODEL} -e ${CDB_EXPT} -r ${CDB_RUN_ID} -y ${CDB_YEAR}`\n') 
     133                    out.writei('for CDB_VAR in ${CDB_VAR_ATTRIBUTION}; do eval PREV_${CDB_VAR}; done\n') 
     134                    out.writei('#Next year\n') 
     135                    out.writei('let "CDB_YEAR+=2"\n') 
     136                    out.writei('CDB_VAR_ATTRIBUTION=`bash $CDB_SOURCE_DIR/retrieval_script.sh -d ${CDB_DIAG_NAME} -v ${CDB_VAR_LIST} -m ${CDB_MODEL} -e ${CDB_EXPT} -r ${CDB_RUN_ID} -y ${CDB_YEAR}`\n') 
     137                    out.writei('for CDB_VAR in ${CDB_VAR_ATTRIBUTION}; do eval NEXT_${CDB_VAR}; done\n') 
     138                    out.writei('let "CDB_YEAR-=1"\n') 
    124139            elif line.lstrip()[:15].upper() == '#!END YEAR LOOP': 
    125140                out.open.write('EndOfScriptMain\n') 
     
    133148                out.writei('CDB_YEAR=${CDB_YEAR_START}\n') 
    134149                #Create yearly_scripts 
     150                out.writei('if [ -z "$CDB_YEARS_FIX_LIST" ];then\n') 
     151                out.inc_indent() 
    135152                out.writei('while [ "$CDB_YEAR" -le "$CDB_YEAR_END" ]; do\n') 
    136153                out.inc_indent() 
     
    139156                out.dec_indent() 
    140157                out.writei('done #CDB_YEAR\n') 
     158                out.dec_indent() 
     159                out.writei('else\n') 
     160                out.inc_indent() 
     161                out.writei('#The user has specified a subset of years to be computed.\n') 
     162                out.writei('for CDB_YEAR in $CDB_YEARS_FIX_LIST; do\n') 
     163                out.inc_indent() 
     164                out.writei('yearly_processing $CDB_YEAR ${CDB_TEMP_DIR}/script_${CDB_YEAR}.sh\n') 
     165                out.dec_indent() 
     166                out.writei('done #CDB_YEAR\n') 
     167                out.dec_indent() 
     168                out.writei('fi\n') 
     169 
    141170                #Process the yearly_scripts 
    142171                if self.debug: 
Note: See TracChangeset for help on using the changeset viewer.