#!@DASPERL ! +-======-+ ! 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 ! ! +-======-+ # # Script to copy restarts from rs location to recycle # # !REVISION HISTORY: # # 28Feb2005 Todling Initial code (very crude). # 05May2005 Todling Updated list of G5GCM rsts #----------------------------------------------------------------------------- use Env; # make env vars readily available use File::Basename; # for basename(), dirname() use File::Copy "cp"; # for cp() use Getopt::Long; # command line options use Shell qw(cat); # cat command # Command line options # -------------------- GetOptions( "h", "mst=s", "scr=s" ); usage() if $opt_h; # FVROOT is where the binaries have been installed # ------------------------------------------------ $fvroot = dirname($FindBin::Bin); $fvroot =~ s|/u/.realmounts/share|/share|; # for portability accros # NAS machines $user = getlogin(); init(); # Define GCM's restart names # -------------------------- if ( $g5gcm ) { @grs_list = ( d catch_internal fvcore_import fvcore_internal irrad_internal lake_internal landice_internal moist_internal ocean_internal solar_internal superdyn_import superdyn_internal surf_import turb_import vegdyn_internal ) } else { @grs_list = ( d p lsm c ); } # Copy files from permanent place to recycle dir # ---------------------------------------------- if ( $g5gcm ) { foreach $fn (@grs_list) { if ( "$fn" == "d" ) { cp("$mst/$expid.rst.lcv.$itime.bin","$scr/$expid/recycle/$expid.d_rst") ; } else { cp("$mst/$expid.${fn}_rst.$itime.bin","$scr/$expid/recycle/$expid.${fn}_rst") ; } } } else { cp($mst/$expid.rst.lcv.$itime.bin ,$scr/$expid/recycle/$expid.d_rst); cp($mst/$expid.rst.chem.$itime.bin ,$scr/$expid/recycle/$expid.c_rst); cp($mst/$expid.rst.phys.$itime.bin ,$scr/$expid/recycle/$expid.p_rst); cp($mst/$expid.rst.lsm.$itime.bin ,$scr/$expid/recycle/$expid.lsm_rst); } #------------------------------------------------------------------------------------ sub init { if ( $#ARGV < 3 ) { print STDERR "missing nymd, nhms and/or expid; see usage"; usage(); } else { # required command lile args $nymd = $ARGV[0]; $nhms = sprintf("%6.6d",$ARGV[1]); $expid = $ARGV[2]; $yyyy = substr($nymd,0,4); $mm = substr($nymd,4,2); $dd = substr($nymd,6,2); $hh = substr($nhms,0,2); $itime = "${nymd}_${hh}z"; } if( $opt_mst ) { $mst = $opt_mst; } else { $mst = "/output/$user/$expid/rs/Y$yyyy/M$mm"; } if( $opt_scr ) { $scr = $opt_scr; } else { $scr = "/scratch1/$user/$expid/recycle"; } $g5gcm = 1 if ( -e "$fvroot/bin/GEOSgcm.x" ); $fvgcm = 1 if ( -e "$fvroot/bin/fvpsas.x" ); } #...................................................................... #------------------------------------------------------------------------------------ sub usage { print <<"EOF"; NAME rst2rcyc - Copy GEOS-4/5 restarts from permanent storage to recycle SYNOPSIS rst2rcyc [...options...] nymd nhms expid DESCRIPTION The following parameter are required nymd Year-month-day, e.g., 19990901 for 01 Sept 1999 nhms Hour-minutes-seconds, e.g., 120000 expid Experiment name OPTIONS -h prints this usage notice -mst directory path name where original restarts are stored, e.g., /output/todling/f5b2_d1/rs/Y2004/M07; default: /output/user/expid/rs/Yyyyy/Mmm -scr directory path where restarts are to be copied to with naming convention for initializing DAS/GCM, e.g., /scratch1/todling/f5b2_d1/recycle; default: /scratch1/user/expid/recycle ENVIRONMENT AUTHOR R. Todling (todling\@gmao.gsfc.nasa.gov), NASA/GSFC/GMAO EOF exit(1) }