npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

marine_meteo

v1.0.1

Published

Typescript client SDK for open meteo marine api

Downloads

8

Readme

OpenMarine SDK

Introduction

Opensource Marine Data API wrapper for Open Meteo with Typescript support

OpenMarine is designed to simplify access to marine weather data from Open Meteo. OpenMarine offers an easy-to-use interface to fetch real-time marine weather information.

Getting Started

Installation

Install OpenMarine using npm:

npm install marine_meteo

Basic Setup

To start using OpenMarine, import it into your project:

import OpenMarine from 'marine_meteo';

Usage Examples

Fetching Hourly Forecast

Retrieve hourly marine weather data:

const marine = new OpenMarine();

async function getHourlyData() {
  try {
    const data = await marine.getHourly(54.3213, 10.1348, ['wave_height']);
    console.log(data);
  } catch (error) {
    console.error('Error fetching data:', error);
  }
}

getHourlyData();

Fetching Daily and Current Forecasts

Similar to the hourly forecast, you can fetch daily and current forecasts:

// Daily Forecast
async function getDailyData() {
  const data = await marine.getDaily(54.3213, 10.1348, ['wave_height_max']);
  // Process data...
}

// Current Forecast
async function getCurrentData() {
  const data = await marine.getCurrent(54.3213, 10.1348, ['wave_height']);
  // Process data...
}

API Reference

The API functions require latitude, longitude, and at least one parameter from the available options. These parameters are necessary for fetching specific marine weather data. The available parameters for each data type are listed below.

getDaily(latitude: number, longitude: number, parameters: string[]): Promise<MarineApiResponse>

  • Functionality: Fetches hourly marine weather data.
  • Parameters:
    • latitude (required): Latitude of the location.
    • longitude (required): Longitude of the location.
    • parameters (required): Array of strings indicating the desired data.
  • Returns: A promise that resolves to the hourly forecast data.
  • Available Parameters for Hourly Data:
    • wave_height
    • wave_direction
    • wave_period
    • wind_wave_height
    • wind_wave_direction
    • wind_wave_period
    • wind_wave_peak_period
    • swell_wave_height
    • swell_wave_direction
    • swell_wave_period
    • swell_wave_peak_period

getDaily(latitude:number, longitude:number, parameters: string[]): Promise<MarineApiResponse>

  • Functionality: Fetches daily marine weather data.
  • Parameters: Similar to getHourly.
  • Available Parameters for Daily Data:
    • wave_height_max
    • wave_direction_dominant
    • wave_period_max
    • wind_wave_height_max
    • wind_wave_direction_dominant
    • wind_wave_period_max
    • wind_wave_peak_period_max
    • swell_wave_height_max
    • swell_wave_direction_dominant
    • swell_wave_period_max
    • swell_wave_peak_period_max

getCurrent(latitude:number, longitude:number, parameters:string[]): Promise<MarineApiResponse>

  • Functionality: Fetches current marine weather data.
  • Parameters: Similar to getHourly.
  • Available Parameters for Current Data:
    • interval
    • wave_height
    • wave_direction
    • wave_period
    • wind_wave_height
    • wind_wave_direction
    • wind_wave_period
    • wind_wave_peak_period
    • swell_wave_height
    • swell_wave_direction
    • swell_wave_period
    • swell_wave_peak_period

Contributing

This project is open source and we welcome contributions. Here are some ways you can contribute:

  • Bug Reports: If you find a bug or a mistake, please report it by opening an issue. Include as much detail as possible to help us understand and reproduce the issue.
  • Feature Requests: If you have an idea for a new feature or an improvement to an existing feature, please open an issue to discuss it. Be sure to explain in detail what you want and why it would be useful.
  • Pull Requests: If you have made a change to the code, please open a pull request. Include a detailed explanation of your changes in the description.

For more information and details you can check Open Meteo