Sha256: 7529f15746ab61eee4313cd6d7968a15cf2cd98c9677302b6866e1dc0dc939ef

Contents?: true

Size: 1.46 KB

Versions: 3

Compression:

Stored size: 1.46 KB

Contents

#!/usr/bin/env ruby

require 'gps_pvt'

# runnable quick example to solve PVT by using RINEX NAV/OBS or u-blox ubx

$stderr.puts <<__STRING__
Usage: #{__FILE__} GPS_file1 GPS_file2 ...
As GPS_file, rinex_nav(*.YYn, *.YYh, *.YYq), rinex_obs(*.YYo), and ubx(*.ubx) format are currently supported.
File format is automatically determined based on its extention described in above parentheses.
If you want to specify its format manually, --rinex_(nav|obs)=file_name or --ubx=file_name are available.
Supported RINEX versions are 2 and 3.
Note: YY = last two digit of year.
__STRING__

options = []

# check options and file format
files = ARGV.collect{|arg|
  next [arg, nil] unless arg =~ /^--([^=]+)=?/
  k, v = [$1.downcase.to_sym, $']
  next [v, k] if [:rinex_nav, :rinex_obs, :ubx].include?(k) # file type
  options << [$1.to_sym, $']
  nil
}.compact

# Check file existence and extension
files.collect!{|fname, ftype|
  raise "File not found: #{fname}" unless File::exist?(fname)
  ftype ||= case fname
  when /\.\d{2}[nhq]$/; :rinex_nav
  when /\.\d{2}o$/; :rinex_obs
  when /\.ubx$/; :ubx
  else
    raise "Format cannot be guessed, use --(format, ex. rinex_nav)=#{fname}"
  end
  [fname, ftype]
}

rcv = GPS_PVT::Receiver::new(options)

puts rcv.header

# parse RINEX NAV
files.each{|fname, ftype|
  rcv.parse_rinex_nav(fname) if ftype == :rinex_nav
}

# other files
files.each{|fname, ftype|
  case ftype
  when :ubx; rcv.parse_ubx(fname)
  when :rinex_obs; rcv.parse_rinex_obs(fname)
  end
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gps_pvt-0.3.0 exe/gps_pvt
gps_pvt-0.2.3 exe/gps_pvt
gps_pvt-0.2.1 exe/gps_pvt