Skip to content

brbza/weather_balloon_miner

Repository files navigation

Weather Balloon Miner

Introduction

Set of scripts developed in Ruby to solve the weather balloon Ambiata's take home excercise.

Setup Instructions

Code was developed and tested using ruby version 2.1.2 but should work without any issue on earlier versions. Besides default ruby libraries, gem sys-filesystem was used to calculate available disk space.

If you don't have this gem installed on your computer you can do it typing on the shell:

gem install sys-filesystem

or using bundle from project's root directory:

bundle install

Scripts

Generate Sample Observation File

To generate a sample file you should type on the shell:

ruby generate_sample.rb output_filename -b BATCHES -s SAMPLES

where:

  • output_filename: desired name for the output file
  • BATCHES: number of observatory batches to be filled on the file
  • SAMPLES: number of observation samples per batch

The total amount of observations will be the product of BATCHES x SAMPLES. Batches are inserted in random order of observatories and dates on the output file.

Calculate Flight Statistics

To calculate the statistics of a observation file, you should run the following command on the shell:

ruby flight_stats.rb weather_balloon_data_file [options]

where options are used to select the desired statistics per observatory to display on the output, as:

  • -i: minimum temperature
  • -a: maxium temperature
  • -e: mean temperature
  • -n: number of observations
  • -d: total flight distance

If no options are supplied, all statistics are printed.

Normalize Temperature and Distance Units of Observations

To normalize units of a observation file, type:

ruby normalize_observations.rb weather_balloon_data_file normalized_output_file [options]

where options are used to select the desired output units, as:

  • -d: distance unit [ meters | kilometers | miles ]
  • -t: temperature unit [ kelvin | celsius | fahrenheit ]

If no options are supplied, defaults are kevin and meters.

Additional files on the repository

  • lib/weather_balloon.rb: module developed to handle the problem.
  • test/test.rb: simple script to test basic functionalities of lib/weather_balloon.rb.

About

Ambiata's take home excercise

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages