      program conver
$debug
	character*5 c
	CHARACTER*1 T2/'-'/
	CHARACTER*4 AA1
	character*9 b
	CHARACTER*2 MES1
	CHARACTER*14 T1/'-AÑO-ENP2.TXT'/
	*,T3/'-ENP2-L1.CSV'/
	*,T4/'-ENP2-L0.CSV'/
	dimension c(50000,200),b(50000,200)
	WRITE(*,*)'QUE ANIO ES?'
	READ(*,'(A4)')AA1
	WRITE(*,*)AA1
	READ(*,*)AA
	WRITE(*,*)'QUE MES ES?'
	READ(*,'(A2)')MES1
	WRITE(*,*)MES1
	READ(*,*)MES
	open(1,file=AA1//T1,status='old')
	open(3,file='xx.txt',status='unknown')
	open(2,file='x.txt',status='unknown')
	open(14,file='XXX.txt',status='unknown')
      OPEN(23,FILE='HORAS.txt',STATUS='OLD')
	OPEN(11,FILE=AA1//T2//MES1//T3,STATUS='UNKNOWN')
	OPEN(12,FILE=AA1//T2//MES1//T4,STATUS='UNKNOWN')
	WRITE(*,*)AA,MES

C	AA=2016.
  	ALT=2241.
C	MES=04

 12   FORMAT(2X,'QUE ANIO ES?')
 13   FORMAT(2X,'QUE MES ES?')
 2	  format(174a1)
 3    format(/)
 4    format(24a9)
 5	format(24(a9,','))
 11   format(50a10)
 14   format(9/)
 15   format(15a10)
 16   FORMAT(20A1,1X,9(A7,1X),A8,1X,A8)
      read(1,3)
	  i=0
 10	  i=i+1
 	  read(1,2,end=29)(c(i,j),j=1,174)
      do 20 j=1,174
	  if(c(i,j) == '/')c(i,j)= ' '
	  if(c(i,j) == ':')c(i,j)= '.'
	  if(c(i,j) == 'a')c(i,j)= '1'
	  if(c(i,j) == 'p')c(i,j)= '2'
 20   continue
  
      write(2,2)(c(i,j),j=1,174)
      go to 10
 29		rewind(2)
      i=0
 41	  i=i+1
 	  read(2,*,end=30)(b(i,j),j=1,30)
	  if(b(i,12) == 'NNW') b(i,12)= '337.5'
	  if(b(i,15) == 'NNW') b(i,15)= '337.5'
	  if(b(i,12) == 'NNE') b(i,12)= '22.5'
	  if(b(i,15) == 'NNE') b(i,15)= '22.5'
	  if(b(i,12) == 'ENE') b(i,12)= '67.5'
	  if(b(i,15) == 'ENE') b(i,15)= '67.5'
	  if(b(i,12) == 'ESE') b(i,12)= '112.5'
	  if(b(i,15) == 'ESE') b(i,15)= '112.5'
	  if(b(i,12) == 'SSE') b(i,12)= '157.5'
	  if(b(i,15) == 'SSE') b(i,15)= '157.5'
	  if(b(i,12) == 'SSW') b(i,12)= '202.5'
	  if(b(i,15) == 'SSW') b(i,15)= '202.5'
	  if(b(i,12) == 'WSW') b(i,12)= '247.5'
	  if(b(i,15) == 'WSW') b(i,15)= '247.5'
	  if(b(i,12) == 'WNW') b(i,12)= '292.5'
	  if(b(i,15) == 'WNW') b(i,15)= '292.5'

	  if(b(i,12) == 'NE') b(i,12)= '45'
	  if(b(i,15) == 'NE') b(i,15)= '45'
	  if(b(i,12) == 'SE') b(i,12)= '135'
	  if(b(i,15) == 'SE') b(i,15)= '135'
	  if(b(i,12) == 'SW') b(i,12)= '225'
	  if(b(i,15) == 'SW') b(i,15)= '225'
	  if(b(i,12) == 'NW') b(i,12)= '315'
	  if(b(i,15) == 'NW') b(i,15)= '315'

	  if(b(i,12) == 'N') b(i,12)= '360'
	  if(b(i,15) == 'N') b(i,15)= '360'
	  if(b(i,12) == 'E') b(i,12)= '90'
	  if(b(i,15) == 'E') b(i,15)= '90'
	  if(b(i,12) == 'S') b(i,12)= '180'
	  if(b(i,15) == 'S') b(i,15)= '180'
	  if(b(i,12) == 'W') b(i,12)= '270'
	  if(b(i,15) == 'W') b(i,15)= '270'
	  do 50 j=1,30
	  if(b(i,j) == '---')b(i,j)= '-9.9'
  50  continue
	  write(3,11) (b(i,j),j=1,50)
	  go to 41
 30	CONTINUE
      REWIND(3)
      CALL L0(AA,MES)
	REWIND(3)
	rewind(14)
	REWIND(23)
	CALL L1(AA,ALT,MES)


$nodebug
 	  stop
	  end

	SUBROUTINE L0(AA,MES)
$DEBUG	
	CHARACTER*1 d
	DIMENSION C(50000,100),B(50000,100),ND(50000),NM(50000),
     *NA(50000), NHO(50000),NMIN(50000),d(50000,200)
C	CHARACTER*5 ESTAC, MES, NA,TXT/'.CSV'/


	LJ=0
	
	DO 98 I=1, 17568
	C(I,3)=AA
 98   CONTINUE

 
 60 	DO 1 I=1,1488
	DO 1 J=5,90
	C(I,1)=INT(((I-1)/48)+1)
	C(I,2)=1
	C(I,J)=-9.9

 1    CONTINUE


 61	III=2832
	IF(AA .EQ. 1996)III=2880
 	IF(AA .EQ. 2000)III=2880
	IF(AA .EQ. 2004)III=2880
	IF(AA .EQ. 2008)III=2880
	IF(AA .EQ. 2012)III=2880
	IF(AA .EQ. 2016)III=2880
	IF(AA .EQ. 2020)III=2880

 	DO 2 I=1489,2880
	DO 2 J=5,90
	C(I,1)=INT(((I-1489)/48)+1)
	C(I,2)=2
	C(I,J)=-9.9
 
 2    CONTINUE

 62	DO 3 I=2881,4368
	DO 3 J=5,90
	C(I,1)=INT(((I-2881)/48)+1)
	C(I,2)=3
	C(I,J)=-9.9

 3    CONTINUE

 63	DO 4 I=4369,5808
	DO 4 J=5,90
	C(I,1)=INT(((I-4369)/48)+1)
	C(I,2)=4
	C(I,J)=-9.9

 4    CONTINUE

 64	DO 5 I=5809,7296
	DO 5 J=5,90
	C(I,1)=INT(((I-5809)/48)+1)
	C(I,2)=5
	C(I,J)=-9.9

 5    CONTINUE

 65	DO 6 I=7297,8736
	DO 6 J=5,90
	C(I,1)=INT(((I-7297)/48)+1)
	C(I,2)=6
	C(I,J)=-9.9

 6    CONTINUE
			
 66	DO 7 I=8737,10224
	DO 7 J=5,90
	C(I,1)=INT(((I-8737)/48)+1)
	C(I,2)=7
	C(I,J)=-9.9

 7    CONTINUE

 67	DO 8 I=10225,11712
	DO 8 J=5,90
	C(I,1)=INT(((I-10225)/48)+1)
	C(I,2)=8
	C(I,J)=-9.9

 8    CONTINUE

 68	DO 9 I=11713,13152
	DO 9 J=5,90
	C(I,1)=INT(((I-11713)/48)+1)
	C(I,2)=9
	C(I,J)=-9.9

 9    CONTINUE

 69	DO 10 I=13153,14640
	DO 10 J=5,90
	C(I,1)=INT(((I-13153)/48)+1)
	C(I,2)=10
	C(I,J)=-9.9

 10   CONTINUE

 70	DO 11 I=14641,16080
	DO 11 J=5,90
	C(I,1)=INT(((I-14641)/48)+1)
	C(I,2)=11
	C(I,J)=-9.9

 11   CONTINUE

 71	DO 12 I=16081,17568
	DO 12 J=5,90
	C(I,1)=INT(((I-16081)/48)+1)
	C(I,2)=12
	C(I,J)=-9.9

 12   CONTINUE

	DO 45 I=1,17568,2
	READ(23,*) C(I,4)
 45	 CONTINUE
C      rewind(23)
	DO 46 I=2,17568,2
	READ(23,*) C(I,4)
	NMIN(I)=30
 46	 CONTINUE
      II=1
 	 
 47	READ(3,*,END=48)(B(II,J),J=1,30)
C 	WRITE(*,*)II
      IF(B(II,4) .EQ. 12.0)B(II,4)=0.0
	IF(B(II,4) .EQ. 12.3)B(II,4)=0.3
	IF(B(II,5) .EQ. 2. .AND. B(II,4) .LT. 12.)B(II,4)=B(II,4)+12.
      IF(B(II,3) .GT. 50.)B(II,3)=B(II,3)+1900.
      IF(B(II,3) .LT. 50.)B(II,3)=B(II,3)+2000.
      II=II+1
	GO TO 47
48    CONTINUE

       II=II-1

c      WRITE(*,*)II
	
      DO 50 I=1,17568
	ND(I)= INT(C(I,1))
	NM(I)= INT(C(I,2))
	NA(I)= INT(C(I,3))
	NHO(I)= INT(C(I,4))
C	NMIN(I)= C(I,4)*100-INT(C(I,4))*100
50	CONTINUE
     	 
      DO 20 N=1,17568
	DO 21 NN=1,II
	IF(C(N,1) .NE. B(NN,1))GO TO 21
	IF(C(N,2) .NE. B(NN,2))GO TO 21
	IF(C(N,3) .NE. B(NN,3))GO TO 21
      IF(C(N,4) .NE. B(NN,4))GO TO 21
	LK=LK+1
	DO 22 J=5,41
	C(N,J)=B(NN,J)
  22  CONTINUE
  21  CONTINUE
  20  CONTINUE

 23   FORMAT(1X,I4.0,'/',I2.2,'/',I2.2,1X,I2.2,':',I2.2,':',I2.2,',',9(F
     *7.1,','),F8.1,',',F8.1)


 	IF(MES .EQ. 1)GO TO 80
 	IF(MES .EQ. 2)GO TO	81
	IF(MES .EQ. 3)GO TO	82
	IF(MES .EQ. 4)GO TO	83
	IF(MES .EQ. 5)GO TO	84
	IF(MES .EQ. 6)GO TO	85
	IF(MES .EQ. 7)GO TO	86
	IF(MES .EQ. 8)GO TO	87
	IF(MES .EQ. 9)GO TO	88
	IF(MES .EQ. 10)GO TO 89
	IF(MES .EQ. 11)GO TO 90
	IF(MES .EQ. 12)GO TO 91

80	DO 111 I=1,1488
	
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 111    CONTINUE

      GO TO 92

 81	DO 112 I=1489,III
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 112    CONTINUE

      GO TO 92

 82	DO 113 I=2881,4368
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 113    CONTINUE

      GO TO 92

 83	DO 114 I=4369,5808
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 114    CONTINUE

      GO TO 92

 84	DO 115 I=5809,7296
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 115    CONTINUE

      GO TO 92

 85	DO 116 I=7297,8736
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 116    CONTINUE

      GO TO 92

 86	DO 117 I=8737,10224
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 117    CONTINUE

      GO TO 92

 87	DO 118 I=10225,11712
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 118    CONTINUE

      GO TO 92

 88	DO 119 I=11713,13152
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 119    CONTINUE

      GO TO 92

 89	DO 120 I=13153,14640
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 120   CONTINUE
   
      GO TO 92

 90	DO 121 I=14641,16080
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 121   CONTINUE

      GO TO 92

 91	DO 122 I=16081,17568
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 122   CONTINUE

 92   CONTINUE


223    format(174a1)
	rewind(14)

	i=0
 161	  i=i+1
 	  read(14,223,end=162)(d(i,j),j=1,174)
c	write(*,*)(d(i,j),j=21,31),i
      im=i
	  go to 161
 162   continue
      REWIND(14)
	do 160 i=1,im
	  do 160 j=21,174
	  if(d(i,j) == '-' .and. d(i,j+1) =='9' .and. d(i,j+2) =='.'
     +	.and. d(i,j+3) =='9')go to 164
     	go to 160
 164   d(i,j)= 'n'
      d(i,j+1)='u'
	d(i,j+2)='l'
	d(i,j+3)='l'
 160  continue
	rewind(14)
      do 163 i=1,im
	 write(14,223)(d(i,j),j=1,174)
 163   continue
      REWIND(14)
	CALL BORRAR(14,12)	 


	  RETURN
$NODEBUG
    	END

		SUBROUTINE L1(AA,ALT,MES)
$DEBUG	
	CHARACTER*1 d
    	DIMENSION C(50000,100),B(50000,100),ND(50000),NM(50000),
     *NA(50000), NHO(50000),NMIN(50000),D(50000,200)
C	CHARACTER*5 ESTAC, MES, NA,TXT/'.CSV'/


C	AA=2014.
	
	  DO 98 I=1, 17568
	  C(I,3)=AA
 98   CONTINUE

 	  DO 1 I=1,1488
	  DO 1 J=5,90
	  C(I,1)=INT(((I-1)/48)+1)
	  C(I,2)=1
    	C(I,J)=-9.9

 1    CONTINUE
	  III=2832
	  IF(AA .EQ. 1996)III=2880
 	  IF(AA .EQ. 2000)III=2880
	  IF(AA .EQ. 2004)III=2880
	  IF(AA .EQ. 2008)III=2880
	  IF(AA .EQ. 2012)III=2880
	  IF(AA .EQ. 2016)III=2880
	  IF(AA .EQ. 2020)III=2880


	  DO 2 I=1489,2880
	  DO 2 J=5,90
	  C(I,1)=INT(((I-1489)/48)+1)
	  C(I,2)=2
	  C(I,J)=-9.9
 
 2    CONTINUE
	   DO 3 I=2881,4368
	  DO 3 J=5,90
	  C(I,1)=INT(((I-2881)/48)+1)
	  C(I,2)=3
    	C(I,J)=-9.9

 3    CONTINUE
	  DO 4 I=4369,5808
	  DO 4 J=5,90
	  C(I,1)=INT(((I-4369)/48)+1)
	  C(I,2)=4
	  C(I,J)=-9.9

 4    CONTINUE
	  DO 5 I=5809,7296
	  DO 5 J=5,90
	  C(I,1)=INT(((I-5809)/48)+1)
	  C(I,2)=5
	  C(I,J)=-9.9

 5    CONTINUE
	  DO 6 I=7297,8736
	  DO 6 J=5,90
	  C(I,1)=INT(((I-7297)/48)+1)
	  C(I,2)=6
	  C(I,J)=-9.9

 6    CONTINUE

	DO 7 I=8737,10224
	DO 7 J=5,90
	C(I,1)=INT(((I-8737)/48)+1)
	C(I,2)=7
	C(I,J)=-9.9

 7    CONTINUE
	DO 8 I=10225,11712
	DO 8 J=5,90
	C(I,1)=INT(((I-10225)/48)+1)
	C(I,2)=8
	C(I,J)=-9.9

 8    CONTINUE
	DO 9 I=11713,13152
	DO 9 J=5,90
	C(I,1)=INT(((I-11713)/48)+1)
	C(I,2)=9
	C(I,J)=-9.9

 9    CONTINUE
	DO 10 I=13153,14640
	DO 10 J=5,90
	C(I,1)=INT(((I-13153)/48)+1)
	C(I,2)=10
	C(I,J)=-9.9

 10   CONTINUE
	DO 11 I=14641,16080
	DO 11 J=5,90
	C(I,1)=INT(((I-14641)/48)+1)
	C(I,2)=11
	C(I,J)=-9.9

 11   CONTINUE
	DO 12 I=16081,17568
	DO 12 J=5,90
	C(I,1)=INT(((I-16081)/48)+1)
	C(I,2)=12
	C(I,J)=-9.9

 12   CONTINUE

	DO 45 I=1,17568,2
	READ(23,*) C(I,4)
C	NMIN(I)=C(I,4)*100
 45	 CONTINUE
	DO 46 I=2,17568,2
	READ(23,*) C(I,4)
	NMIN(I)=30
C	WRITE(*,*)C(I,42)
C	PAUSE
 46	 CONTINUE


 	G=9.81
	R=287
	GAMA=0.0065
	TK=273.15
	EX=G/(R*GAMA)
	LJ=0

      II=1
 	 
 47	READ(3,*,END=48)(B(II,J),J=1,30)
      IF(B(II,4) .EQ. 12.0)B(II,4)=0.0
	IF(B(II,4) .EQ. 12.3)B(II,4)=0.3
 	IF(B(II,5) .EQ. 2. .AND. B(II,4) .LT. 12.)B(II,4)=B(II,4)+12.
	IF(B(II,3) .GT. 50.)B(II,3)=B(II,3)+1900.
      IF(B(II,3) .LT. 50.)B(II,3)=B(II,3)+2000.

		 IF(B(II,20) .LT. 900.0)GO TO 49
  	COC=(((B(II,6)+TK)+GAMA*ALT)/(B(II,6)+TK))**EX
	B(II,20)=B(II,20)/COC

49    CONTINUE

	IF(B(II,6) .GT. 40.0)B(II,6)=-9.9
	IF(B(II,6) .LT. -10.0)B(II,6)=-9.9

	IF(B(II,9) .GT. 100.0)B(II,9)=-9.9
	IF(B(II,9) .LT. 0.0)B(II,9)=-9.9

	IF(B(II,11) .GT. 20.0)B(II,11)=-9.9
	IF(B(II,11) .LT. 0.0)B(II,11)=-9.9

	IF(B(II,12) .GT. 360.0)B(II,12)=-9.9
	IF(B(II,12) .LT. 0.0)B(II,12)=-9.9

	IF(B(II,14) .GT. 30.0)B(II,14)=-9.9
	IF(B(II,14) .LT. 0.0)B(II,14)=-9.9

	IF(B(II,15) .GT.360.0)B(II,15)=-9.9
	IF(B(II,15) .LT. 0.0)B(II,15)=-9.9

	IF(B(II,20) .LT. 740.0)B(II,20)=-9.9
	IF(B(II,20) .GT. 820.0)B(II,20)=-9.9
	
      IF(B(II,21) .GT. 50.0)B(II,21)=-9.9
	IF(B(II,21) .LT. 0.0)B(II,21)=-9.9

	IF(B(II,23) .GT.1450.0)B(II,23)=-9.9
	IF(B(II,23) .LT. 0.0)B(II,23)=-9.9

	IF(B(II,26) .GT. 15.0)B(II,26)=-9.9
	IF(B(II,26) .LT. 0.0)B(II,26)=-9.9

	IF(B(II,27) .GT. 3.0)B(II,27)=-9.9
	IF(B(II,27) .LT. 0.0)B(II,27)=-9.9

      II=II+1
	GO TO 47
48    CONTINUE

      II=II-1
      WRITE(*,*)II

	DO 57 I=1,II
 	IF(B(II,5) .EQ. 2. .AND. B(II,4) .LT. 12.)B(II,4)=B(II,4)+12.
      IF(B(II,4) .EQ. 12.0)B(II,4)=0.0
	IF(B(II,4) .EQ. 12.3)B(II,4)=0.3
57    CONTINUE
	
      DO 50 I=1,17568
	ND(I)= INT(C(I,1))
	NM(I)= INT(C(I,2))
	NA(I)= INT(C(I,3))
	NHO(I)= INT(C(I,4))
C	IF(NHO(I) .EQ. 0)WRITE(*,*)NHO(I),I,B(I,4)
C	NMIN(I)= C(I,4)*100-INT(C(I,4))*100
50	CONTINUE
     	 

      DO 20 N=1,17568
	DO 21 NN=1,II
	IF(C(N,1) .NE. B(NN,1))GO TO 21
	IF(C(N,2) .NE. B(NN,2))GO TO 21
	IF(C(N,3) .NE. B(NN,3))GO TO 21
      IF(C(N,4) .NE. B(NN,4))GO TO 21
	LK=LK+1
	DO 22 J=5,41
	C(N,J)=B(NN,J)
  22  CONTINUE
  21  CONTINUE
C      WRITE(*,*)LK
  20  CONTINUE

 23   FORMAT(I4.0,'/',I2.2,'/',I2.2,1X,I2.2,':',I2.2,':',I2.2,',',9(F7.1
     *,','),F8.1,',',F8.1)

 	IF(MES .EQ. 1)GO TO 80
 	IF(MES .EQ. 2)GO TO	81
	IF(MES .EQ. 3)GO TO	82
	IF(MES .EQ. 4)GO TO	83
	IF(MES .EQ. 5)GO TO	84
	IF(MES .EQ. 6)GO TO	85
	IF(MES .EQ. 7)GO TO	86
	IF(MES .EQ. 8)GO TO	87
	IF(MES .EQ. 9)GO TO	88
	IF(MES .EQ. 10)GO TO 89
	IF(MES .EQ. 11)GO TO 90
	IF(MES .EQ. 12)GO TO 91

 80	DO 111 I=1,1488
	
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 111    CONTINUE

	GO TO 92

 81	DO 112 I=1489,III
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 112    CONTINUE

      GO TO 92

 82	DO 113 I=2881,4368
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 113    CONTINUE

      GO TO 92

 83	DO 114 I=4369,5808
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 114    CONTINUE

      GO TO 92

 84	DO 115 I=5809,7296
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 115    CONTINUE

      GO TO 92

 85	DO 116 I=7297,8736
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 116    CONTINUE
  
      GO TO 92

 86	DO 117 I=8737,10224
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 117    CONTINUE

      GO TO 92

 87	DO 118 I=10225,11712
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 118    CONTINUE

      GO TO 92

 88	DO 119 I=11713,13152
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 119    CONTINUE
     
	 GO TO 92

 89	DO 120 I=13153,14640
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 120   CONTINUE
      
	GO TO 92

 90	DO 121 I=14641,16080
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 121   CONTINUE

 91	DO 122 I=16081,17568
	WRITE(14,23)NA(I),NM(I),ND(I),NHO(I),NMIN(I),LJ,C(I,6),C(I,9),(C(I
     *,J),J=11,12),C(I,14),C(I,15),C(I,20),C(I,21),C(I,23),C(I,26),C(I,2
	*7)
 122   CONTINUE

 92	CONTINUE
223    format(174a1)
	rewind(14)

	i=0
 161	  i=i+1
 	  read(14,223,end=162)(d(i,j),j=1,174)
c	write(*,*)(d(i,j),j=21,31),i
      im=i
	  go to 161
 162   continue
	do 160 i=1,im
	  do 160 j=21,174
	  if(d(i,j) == '-' .and. d(i,j+1) =='9' .and. d(i,j+2) =='.'
     +	.and. d(i,j+3) =='9')go to 164
     	go to 160
 164   d(i,j)= 'n'
      d(i,j+1)='u'
	d(i,j+2)='l'
	d(i,j+3)='l'
 160  continue
	rewind(14)
      do 163 i=1,im
	 write(14,223)(d(i,j),j=1,174)
 163   continue	 
	REWIND(14)
	CALL BORRAR(14,11)

c	CLOSE(11)
$NODEBUG
	RETURN
	END
	subroutine borrar(nb,na)
!erase blank space in a string
!run over every character of the string and just take every non-blank in other variable.

c      implicit none
      character (len=100) str1,str2,str4
	character (len=20)str3
      integer i
	write(na,33)
10	read(nb,3,end=20)str3,str4
      str2=''                   !in this variable will be save non-blank spaces  
      str1=str4            !Test string with blank spaces

c      write(*,*)str3, str1

      do i=1,len(str1)   
      if (str1(i:i).ne.' ')str2=trim(str2)//trim(str1(i:i))   
      end do

      write(na,3)str3, str2
	go to 10
20    continue
3     format(a20,a100)
 33   FORMAT('Programa de Estaciones Meteorologicas del Bachillerato Uni
     *versitario  (PEMBU)',/,
     *'www.ruoa.unam.mx/pembu',/,
     *'Estacion ENP2-UNAM,Ciudad de Mexico',/,
     *'Lat 19.3840 N, Lon 99.0999 W, Alt 2241 msnm',/,
     *'Horario UTC-6h',/,
     *'Datos meteorologicos',/,/,
     *'Fecha_hora,Temp,Hum_Rel,Rapidez_v_sostenido,Dir_v_sostenido,Rapid
     *ez_rachas,Dir_rachas,Presion_bar,Precipitacion,Rad_Solar,Indice_UV
     *,Dosis_UV',/,
	*'aaaa/mm/dd HH:MM:SS,C,%,m/s,grados,m/s,grados,hPa,mm,W/m2,adimens
     *ional,mJ/cm2')
	 return
       end 