! +-======-+ ! 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 ! ! +-======-+ integer :: parse integer :: is, ie, id, k, last parse = 0 last = len_trim(text) is = index( trim(text), trim(label) ) if (is == 0) return ! position of initial starting pointer is = is + len_trim(label) ! move starting pointer after label is = is + scan( text(is:last), '=' ) ! move starting pointer after "=" do k = 1, size(values(:)) ! position of ending pointer id = scan( text(is:last), ',' ) if (id == 0) then ie = last ! no trailing comma, use end of text string else ie = is+id-2 endif ! decode value ! print *, 'k,is,ie,id,last=',k,is,ie,id,last ! print *, 'DECODE: ', text(is:ie) read ( text(is:ie), *, err=99 ) values(k) parse = parse+1 ! parse is the number of values decoded if (ie == last) exit ! end of text string ... DONE is = is+id ! move starting pointer after "," if (is > last) exit ! end of text string ... DONE enddo return 99 continue call mpp_error (FATAL,'in parse, error decoding data')