Code Monkey home page Code Monkey logo

pysurfcast's Introduction

pysurfcast

pysurfcast is a Python script that fetches surf forecast data for a specified surf spot using the Spitcast API and outputs it in a number of formats for various uses.

pysurfcast displays a visualization of surf forecasts for a specified surf spot either in a terminal or as an image.

pysurfcast is not affiliated with Spitcast. However, the author of pysurfcast thinks that Spitcast is awesome. Without Spitcast, none of this would be possible.

pysurfcast is in sort of an awkward phase in its life. It is undergoing strange changes that are sometimes a little bit scary. New hormones are beginning to flow through its body, which make pysurfcast a little bit crazy at times.

Please don't make fun of pysurfcast; it's very sensitive.

Requirements

Running

Docker example:

git clone https://github.com/cbrenton/pysurfcast
cd pysurfcast
docker run -v $(pwd)/images:/images sprutner/pysurfcast -s 6 -p

Options:

  • -h: Print help message and exit.
  • -p: Echo the spot name to the terminal. This option is nice for using pysurfcast with GeekTool on OS X.
  • -s [spotId]: Get forecast data for the spot specified by spotID.
  • -t: Output the forecast as text instead of an image.
  • -v: Use verbose mode. Currently does nothing.

Examples:

  • Output the forecast for spot 163 (Morro Bay) as an image and echo "Morro Bay" to the terminal:

    ./pysurfcast.py -s 163 -p

alt text

  • Output the forecast for spot 6 (Natural Bridges) as text in the terminal:

    ./pysurfcast.py -s 6 -t

alt text

Interpreting Image Output

The image created by this script will show surf conditions at a single spot for the current hour. Several different factors can be determined, or at least guesstimated, from the image.

  • There will be between one and five circles of varying size. The number of circles represents wave shape. Spitcast quantifies this as Poor, Poor-Fair, Fair, Fair-Good, or Good. Placing this on a scale from 1 to 5 gives the number of circles that are drawn.

  • The size of the circles represents wave height. The circle will be 50px tall when the wave height is greater than or equal to the "maximum" height. Circle height is proportional to max height, so if the waves are half of the max height, the circles will be 25px tall. At 0 feet, the circles will be 0px tall. By default, the max is set as 8 feet, but that can be changed in the code. I should add a flag that lets you specify max height.

  • This is not fully working correctly, but the thickness of the border around the circle will eventually represent the maximum wave size for the day. It will work in the same way as the wave height, but it will draw a dark circle behind the colored one. At the peak wave size for the day, the border will not be visible.

Interpreting Text Output

Coming as soon as I remember how this works.

License and Stuff

Copyright (c) 2011, Chris Brenton

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of pysurfcast nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CHRIS BRENTON BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

pysurfcast's People

Contributors

cbrenton avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

sprutner

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.