# /bin/csh -f # set_test_config_by_time - add config info to ground test data. # Synopsis: # set_test_config_by_time # Where interval is in the form time/interval, e.g. # set_test_config_by_time 2006.10.21_15:00/12h will get the daylight hours for 21 Oct 2006 # This script will find the times for all images in the specified interval then # for each of those times it will find the configuration files closest to but before # that time and add the keyword values to the image series headers. # It will look for "FTS" files and for "PCU" files. # set echo set noglob set TIME = $1 # source of image times and FSN, assume index key: FSN, T_OBS # set IMAGE_SERIES = hmi_ground.lev0_ral set IMAGE_SERIES = hmi_ground.lev0_fsfm_0445_0009 # source of config files, assume index keys: type, date, and segment: file set CONFIG_SERIES = hmi_ground.lev0_config # target series to update. assume index key fsn, and other keys: date and keys from config files. set CONFIG_FILES = hmi_ground.test_config_files # make temp file name set NOW = `date "+%Y%m%d"` set TMP = /tmp/pcufsn.$NOW.$$ mkdir $TMP # get list of images to process show_keys 'ds='$IMAGE_SERIES'[]['$TIME']' key=T_OBS,FSN -q >$TMP/times set nimages = `wc -l <$TMP/times` # Loop through available images to get PCU and other setup configuration keywords. set iimage = 0 while ($iimage < $nimages) # get this time and increment for next one set IMAGE_INFO = `head -1 $TMP/times` tail +2 $TMP/times >$TMP/moretimes mv $TMP/moretimes $TMP/times # set config info and fsn for this time set IMAGE_TIME = IMAGE_INFO[1] set FSN = IMAGE_INFO[2] set_config_by_time.csh $IMAGE_TIME $FSN @ iimage = $iimage + 1 end