cat > p.f <<\EOR C=============================================================================C C International Comprehensive Ocean-Atmosphere Data Set (ICOADS) 22 Aug 2012 C C Filename:level: gts:01J Fortran 77 program+shell C C Purpose: Convert NCDC GTS data to IMMA Author: S.Lubker C C=============================================================================C C Software Revision Information (previous version: 29 May 2012, level 01I): C IMMA1 with attm5 including relative humidity (RH) and setting the relative C humidity indicator to 1 (Relative humidity in whole Percentage, measured C and originally reported). C-----------------------------------------------------------------------3456789 C Software documentation for the (modifiable) example program {gts} and routine C {locate}, and for the (invariant) user-interface routines {ship,buoy,cman}. C C As provided {gts}: (a) reads marine Global Telecommunication System (GTS) C data from standard input, (b) outputs the data on standard output in IMMA C format, and (c) outputs a summary of any errors encountered on fort.8. C The recognized GTS data types are SHIP (FM 13), BUOY (FM 18) and Coastal- C Marine Automated Network (C-MAN) data (modified FM 13). These data types C are distinguished by code identifiers BBXX, ZZYY, and CMAN, respectively. C C Each input report consist of an 18-character header followed by a space C and the GTS string, e.g.: C BBXX01040220040212 HRRF 01234 99197 31492 46/// /1319 10280 40168 C where the header provides the code identifier and receipt date/time C (assembled from bulletin header information) according to this format: C ZZYY01060320010923 Header example C ^^^^ Code identifier (BBXX, ZZYY, or CMAN) C ^^ Sequence number for split messages (obsolete; unused) C ^^ Month C ^^ Day C ^^^^ Year C ^^ Hour C ^^ Minute C Or an 37-character header extended with the WMO "abbreviated heading" C (assembled from bulletin header information): C ZZYY01060320010923SSVX13KWBC060923RRA C TTAAii Bulletin ID C CCCC Collecting centre C YYGGgg Day Hour Minute C BBB Delayed or Correction or Amendment C C The output IMMA data have a minimal IMMA structure (core+attm1+attm5+attm99) C with deck (992-995) and SID (114) assigned appropriately for the NCDC GTS C data, and are formatted according to ICOADS, instead of NCDC, conventions. C The obsolete fixed NCDC structure (core+attm1+attm5+attm6+attm99) and NCDC C conventions (signed longitude representation and leading zeros in some C numeric fields) could if necessary be added via {qcimma}, as can settings C of NID and C1 (e.g., for VOSClim data) and QC flags. C C External library required: {lmrlib}. C Machine dependencies: none known. C-----------------------------------------------------------------------3456789 program gts implicit integer(a-e,g-z) character str*1019 100 read(*,'(a)',end=900)str lth=index(str,' ') if (str(1:4).eq.'ZZYY') then call buoy(str(:lth),str(lth+1:)) else if (str(1:4).eq.'BBXX') then call ship(str(:lth),str(lth+1:)) else if (str(1:4).eq.'CMAN') then cc call ship(str(:lth),str(lth+1:)) call cman(str(:lth+6),str(lth+7:)) else cc print *,str cc stop 'STOP' endif goto 100 900 call prnstr end c-----------------------------------------------------------------------3456789 subroutine locate(id,latit,longit) c identify C-MAN locations using an external list character*(*) id real latit,longit parameter(nlist=9999) character list(nlist)*64 character xml*999 data n/0/ save n c if (n.eq.0) then open(13,file='activestations.xml') open(14,file='activestations.txt') write(14,'(a)')'stations missing in activestations.xml' 10 read(13,'(a)',end=100)xml if (index(xml,'