#!/bin/csh -f # +-======-+ # Copyright (c) 2003-2018 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 file = $1 set arch = `uname` # Check BASEDIR # ------------- if( ! $?BASEDIR ) then echo " " echo "Environment variable BASEDIR must be defined before use\!" echo " " exit 7 endif if( -e $BASEDIR/$arch/bin/hdfdump ) then set hdfdump = hdfdump # Old HDF4 Format else set hdfdump = ncdump set version = `file -b $1` if("$version" == "Hierarchical Data Format (version 4) data") then if( -e $BASEDIR/$arch/bin/ncdump-hdf4 ) then set hdfdump = ncdump-hdf4 endif endif endif set nymdb = `$BASEDIR/$arch/bin/$hdfdump -h $file | grep time:begin_date | cut -d " " -f 3` set nhmsb = `$BASEDIR/$arch/bin/$hdfdump -h $file | grep time:begin_time | cut -d " " -f 3` set dtinc = `$BASEDIR/$arch/bin/$hdfdump -h $file | grep time:time_increment | cut -d " " -f 3` set tmax = `$BASEDIR/$arch/bin/$hdfdump -h $file | grep "time = " | grep -v "time:"` if( $tmax[3] == UNLIMITED ) then set tmax = `echo $tmax | cut -d " " -f 6 | cut -c2-` else set tmax = $tmax[3] endif set length = `echo $nymdb | awk '{print length}'` if( $length == 5 ) set nymdb = 000$nymdb if( $length == 6 ) set nymdb = 00$nymdb if( $length == 7 ) set nymdb = 0$nymdb @ nhmsb = $nhmsb if( $nhmsb < 10 ) set nhmsb = 0$nhmsb if( $nhmsb < 100 ) set nhmsb = 0$nhmsb if( $nhmsb < 1000 ) set nhmsb = 0$nhmsb if( $nhmsb < 10000 ) set nhmsb = 0$nhmsb if( $nhmsb < 100000 ) set nhmsb = 0$nhmsb @ mod1 = $dtinc % 100 @ mod2 = $dtinc % 10000 @ nsecf = ( $dtinc / 10000 ) * 3600 + ( $mod2 / 100 ) * 60 + $mod1 @ ndt = ( $tmax - 1 ) * $nsecf set ending_date = `$GEOSUTIL/post/tick $nymdb $nhmsb $ndt` set nymde = $ending_date[1] set nhmse = $ending_date[2] set length = `echo $nymde | awk '{print length}'` if( $length == 5 ) set nymde = 000$nymde if( $length == 6 ) set nymde = 00$nymde if( $length == 7 ) set nymde = 0$nymde #set month0 = `echo $nymdb | cut -c5-6` #set month1 = `echo $nymde | cut -c5-6` #echo Begin Date: $nymdb #echo Begin Time: $nhmsb #echo Ending Date: $nymde #echo Ending Time: $nhmse #echo Time Inc: $dtinc echo $nymdb $nhmsb $nymde $nhmse $nsecf