Excerpts from Carolin Boese's message of 2014-03-04 08:37:31 +0100:
> Hi all,
> 
> Does anyone have a python script that reads the STATION0.HYP file? I
> am rewriting an existing python routine to work with seisan data and
> input files, and any existing scripts would speed this process up a
> lot.
> 
> Many thanks in advance
> 
> Carolin

I have one that writes station positions, perhaps the format is useful
when writing a read-routine for the relevant part:

Regards, Gaute

stationsf = open ('STATION0.HYP', 'a')
for s in stations:
  # convert to DDMMMMM (where last three M is decimals without decimal point of
  # minute)
  latitude  = int(decimaldegree_ddmm_mmm(positions[s][0]))
  longitude = int(decimaldegree_ddmm_mmm(positions[s][1]))

  stationsf.write ('  {station:<4s}{latitude:>7d}{northsouth:s}{longitude: 
>8d}{eastwest:s}{height:4d}\n'.format (
      station   = s,
      latitude  = latitude,
      northsouth = ('N' if (positions[s][0] > 0) else 'S'),
      longitude = longitude,
      eastwest  = ('E' if (positions[s][1] > 0) else 'W'),
      height = 0
    ))

## decimaldegree_ddmm_mm:

# outputs degrees with decimal minutes, without
# decimal point and with three digits (suitable for hypocenter)
def decimaldegree_ddmm_mmm (s):
  deg   = math.floor (s)
  mint  = (s - deg) * 60.0
  min   = math.floor (mint)
  mind  = (mint - min) * 1000

  r = '%02d%02d%03d' % (deg, min, mind)

  return r

_______________________________________________
seisan mailing list
[email protected]
http://mailman.uib.no/listinfo/seisan

Reply via email to