Code Monkey home page Code Monkey logo

python-magicseaweed's People

Contributors

jcconnell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

python-magicseaweed's Issues

Timestamps - localTimestamp/issueTimestamp, conversion, and URL parameters

Issue

There may be in issue with how the timestamps are handled in this library. I have reached out to MSW for additional information. Some questions that should be answered:

  • When querying the API, should the timestamps provided to the start and end URL parameters be in the user's local time or in UTC?
  • localTimestamp is described in the docs as Unix timestamp adjusted to represent local time for this location. Should this be converted to a Python datetime object as datetime.fromtimestamp() or datetime.utcfromtimestamp().
  • issueTimestamp is described as in the docs as GMT unix time for the start of this forecast. Although we call it the ‘issue’ time it’ll always actually become available after this time because we need to create or obtain the model data and prepare it for delivery. Is this referring to the time when the forecast was made?

Observations

  • Example query with start and end parameters set to datetime.now().timestamp() (1533770006.53376) returned:
[
  {
    "timestamp": 1533772800,
    "localTimestamp": 1533751200,
    "issueTimestamp": 1533729600,
    "fadedRating": 0,
    "solidRating": 0,
    "swell": {
      "absMinBreakingHeight": 0.82,
      "absMaxBreakingHeight": 1.28,
      "probability": 75,
      "unit": "ft",
      "minBreakingHeight": 1,
      "maxBreakingHeight": 1,
      "components": {
        "combined": {
          "height": 1.8,
          "period": 7,
          "direction": 268.24,
          "compassDirection": "E"
        },
        "primary": {
          "height": 0.9,
          "period": 7,
          "direction": 253.39,
          "compassDirection": "ENE"
        },
        "secondary": {
          "height": 0.9,
          "period": 8,
          "direction": 285.52,
          "compassDirection": "ESE"
        },
        "tertiary": {
          "height": 1.1,
          "period": 3,
          "direction": 303.51,
          "compassDirection": "ESE"
        }
      }
    },
    "wind": {
      "speed": 5,
      "direction": 305,
      "compassDirection": "SE",
      "chill": 91,
      "gusts": 9,
      "unit": "mph"
    },
    "condition": {
      "pressure": 1018,
      "temperature": 86,
      "weather": "1",
      "unitPressure": "mb",
      "unit": "f"
    },
    "charts": {
      "swell": "https://hist-1.msw.ms/wave/750/21-1533772800-1.gif",
      "period": "https://hist-1.msw.ms/wave/750/21-1533772800-2.gif",
      "wind": "https://hist-1.msw.ms/gfs/750/21-1533772800-4.gif",
      "pressure": "https://hist-1.msw.ms/gfs/750/21-1533772800-3.gif",
      "sst": "https://hist-1.msw.ms/sst/750/21-1533772800-10.gif"
    }
  }
]
  • Converting localTimestamp to a datetime object produced these results:
>>> datetime.utcfromtimestamp(1533751200).strftime("%a %-I %p")
'Wed 6 PM'
>>> datetime.fromtimestamp(1533751200).strftime("%a %-I %p")
'Wed 2 PM'
  • Converting issueTimestamp to a datetime object produced these results:
>>> datetime.utcfromtimestamp(1533729600).strftime("%a %-I %p")
'Wed 12 PM'
>>> datetime.fromtimestamp(1533729600).strftime("%a %-I %p")
'Wed 8 AM'

Theory

  • localTimestamp should use datetime.utcfromtimestamp()
  • issueTimestamp should use datetime.fromTimestamp()
  • These seem contradictory to the documentation's description.

Not getting Swell direction attribute

I'm not receiving the swell direction attribute. The only attributes I have showing are:

for the breaking min/max sensors

air_pressure: 1016mb
air_temp: 22° c
stars: 0 solid, 0 faded
begins: Tue 12 PM
issued: Mon 6 PM
max_breaking_height: 0.2 m
min_breaking_height: 0.1 m
probability: 95%
swell_period: 5 seconds
wind_chill: 17°
wind_direction: 219° NE
wind_gusts: 41 kph
wind_speed: 33 kph
unit_of_measurement: m

for the forecast sensor

12PM: 0.1 - 0.2 m
3PM: 0.2 - 0.3 m
6PM: 0.2 - 0.3 m
9PM: 0.2 - 0.3 m
12AM: 0.2 - 0.3 m
3AM: 0.3 - 0.5 m
6AM: 0.3 - 0.4 m
9AM: 0.3 - 0.4 m
unit_of_measurement: m

when I look at my API through a browser there is definitely swell direction information there for whatever reason though it is not being displayed.

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.