      subroutine rdata(name)

c---------------------------------------------------------------------
c reads sythetically calculated data shaved from gensyn output
c sets data classes = 4,5,6, alt=400, yrf,yrl, & yr=1995.
c redefines id=1 to be syndat (what was evec-1 anyway?)
c jcain 5/29/1999
c---------------------------------------------------------------------

      integer*1 k
      character id(15)*10,name*10 
      common/datar/iskip,dlat,dlon,alt,yr,c(2,10),yf,yl 

c---------------------------------------------------------------------
c c array order is (component,component weight) where 
c order is d,dip,h,x,y,z,f,xd,yd,zd.
c---------------------------------------------------------------------

      dimension e(3),ilcd(3),cw(10,15)
c figure out what needs to be saved
      save cw
      logical first
      data id/'syndat','pvec-2','scal-3','canair-4','sp66-5','newpm-6'
     x,'van3-7','cos49-8','ogo2-9','ogo4-10','ogo6-11','obsv-12', 
     x 'mgsatf-13','mgstv-14','Orstf-15'/
      data ilcd/4,5,6/,first/.true./

c---------------------------------------------------------------------
c note that k=-12 are error estimates of following sv data components
c weight order is d dip h x y z f xd yd zd for each data class
c---------------------------------------------------------------------

      data cw/
     1  3*0.,3*1.,4*0., 
     2 10*0., 
     3 10*0., 
     4 10*0., 
     5 10*0., 
     6 10*0., 
     7 10*0., 
     8 10*0., 
     9 6*0.,1.,3*0., 
     t 6*0.,1.,3*0., 
     e 6*0.,1.,3*0., 
     w 10*0., 
     h 10*0., 
     r 10*0., 
     f 6*0.,1.,3*0./ 
      data itest/0./

c--------------------------------------------------------------------
c format statements
c--------------------------------------------------------------------

 11   format(i5,10f5.0)

c--------------------------------------------------------------------
c Synthetic data info below
c--------------------------------------------------------------------

c         'synthetic data computed from IGRF95 for 1995 at 400 km'
c         yr=1995.    ilcd = 4,5,6        
c         yf=1995.0   k=1 -> name=id(1)
c         yl=1995.0 

c--------------------------------------------------------------------
c     enter common data on first read
      if(first) then
        first=.false.
        k=1
        name=id(k)
        yr=1995.
        yrf=1995.0
        yrl=1995.0
        alt=400.
      call pawt(dlat,dlon,awt)  
      write (6,*)'synthetic data from IGRF95 for 1995 at 400 km'
      do 10 j=1,15
         print 11,j,(cw(k,j),k=1,10) 
         do 10 i=1,10
            if(cw(i,j).eq.0.) cw(i,j)=999999999.
 10         cw(i,j)=cw(i,j)**2
      endif
      do 100 i=1,iskip
 4       read (10,end=15) dlat,dlon,x,y,z
	   e(1) = x
           e(2) = y
           e(3) = z
         if (iabs(k).eq.12) then 
            do 2 j=1,3

c--------------------------------------------------------------------
c use standard errors of least squares fits as weights for secular 
c change: not modified since not reading sv data jcc 5/24/1999
c--------------------------------------------------------------------

 2          cw(j+7,12)=e(j)**2
         read (10,end=15) k,imjd,ims,dlat,dlon,b,alt
c      wrong read statement format for sv data 
      end if
 100  continue
      call pawt2(dlat,dlon,awt)

c--------------------------------------------------------------------

c      name=id(k)
c      yf=amin1(yr,yf) 
c      yl=amax1(yr,yl)

c--------------------------------------------------------------------

      do 3 i=1,10 
 3       c(1,i)=0.
      do 13 i=1,3
         j=ilcd(i)

c--------------------------------------------------------------------
c assume that first zero ilcd means no more data in record
c--------------------------------------------------------------------

         if(j.eq.0) return 
         c(1,j)=e(i)
 13      c(2,j)=awt*cw(j,k)
 14   return
 15   rewind 10
      iskip=0
      return
      end 






