#!/bin/csh -f # +-======-+ # Copyright (c) 2003-2007 United States Government as represented by # the Admistrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # THIS OPEN SOURCE AGREEMENT ("AGREEMENT") DEFINES THE RIGHTS OF USE, # REPRODUCTION, DISTRIBUTION, MODIFICATION AND REDISTRIBUTION OF CERTAIN # COMPUTER SOFTWARE ORIGINALLY RELEASED BY THE UNITED STATES GOVERNMENT AS # REPRESENTED BY THE GOVERNMENT AGENCY LISTED BELOW ("GOVERNMENT AGENCY"). # THE UNITED STATES GOVERNMENT, AS REPRESENTED BY GOVERNMENT AGENCY, IS AN # INTENDED THIRD-PARTY BENEFICIARY OF ALL SUBSEQUENT DISTRIBUTIONS OR # REDISTRIBUTIONS OF THE SUBJECT SOFTWARE. ANYONE WHO USES, REPRODUCES, # DISTRIBUTES, MODIFIES OR REDISTRIBUTES THE SUBJECT SOFTWARE, AS DEFINED # HEREIN, OR ANY PART THEREOF, IS, BY THAT ACTION, ACCEPTING IN FULL THE # RESPONSIBILITIES AND OBLIGATIONS CONTAINED IN THIS AGREEMENT. # # Government Agency: National Aeronautics and Space Administration # Government Agency Original Software Designation: GSC-15354-1 # Government Agency Original Software Title: GEOS-5 GCM Modeling Software # User Registration Requested. Please Visit http://opensource.gsfc.nasa.gov # Government Agency Point of Contact for Original Software: # Dale Hithon, SRA Assistant, (301) 286-2691 # # +-======-+ set HISTORY = $1 # Test for New HISTORY.rc Format # ------------------------------ set test = `grep COLLECTIONS $HISTORY` if( "$test" != "" ) then # Find Collections # ---------------- set HISTORY = `cat $HISTORY | sed -e 's/,/ , /g'` @ n = 1 while( $n <= $#HISTORY ) if( $HISTORY[$n] == COLLECTIONS: ) then set collections = '' @ m = $n + 1 while( $HISTORY[$m] != "::" ) set collection = `echo $HISTORY[$m] | sed -e "s/'//g"` set collections = `echo $collections $collection` @ m = $m + 1 end @ n = $#HISTORY + 1 endif @ n = $n + 1 end echo ${collections} else # Determine Output Stream Names from HISTORY RC File # -------------------------------------------------- set streams = "" set filenames = `cat $HISTORY | grep -i filename | grep -v "/dev/null" | grep -v "#"` foreach filename ( $filenames ) set filename = `echo $filename | grep "'" ` if( $filename != "" ) then set filename = `echo $filename | cut -d "'" -f2` set streams = `echo $streams $filename` endif end # Remove Template Syntax from Stream Names # ---------------------------------------- set output_streams = "" foreach stream ( $streams ) set output_stream = "" @ n = 1 set node = `echo $stream | cut -d "." -f$n` while( "${node}" != '' ) set add_node = TRUE @ m = 1 set bit = `echo $node | cut -b $m` while( "${bit}" != '' ) if( "${bit}" != '%' ) then @ m = $m + 1 set bit = `echo $node | cut -b $m` else set add_node = FALSE set bit = '' endif end if( ${add_node} == 'TRUE' ) then if( "${output_stream}" == '' ) then set output_stream = ${node} else set output_stream = `echo ${output_stream}.${node}` endif endif @ n = $n + 1 set node = `echo $stream | cut -d "." -f$n` if( $node == ${output_stream} ) set node = '' end set output_streams = `echo ${output_streams} ${output_stream}` end echo ${output_streams} endif