Skip to content

This is a light API to the NOAA CLASS (Comprehensive Large Array-Data Stewardship System).

License

Notifications You must be signed in to change notification settings

UARENForecasting/noaaclass

Repository files navigation

noaaclass

Gitter

License Downloads Build Status Coverage Status Code Health PyPI version Stories in Ready

A python library that allow to request images to the NOAA CLASS (Comprehensive Large Array-Data Stewardship System).

Requirements

If you want to use this library on any GNU/Linux or OSX system you just need to execute:

$ pip install noaaclass

If you want to improve this library, you should download the github repository and execute:

$ make virtualenv deploy

Under ubuntu/debian you can try with:

$ make ubuntu virtualenv deploy

Testing

To test all the project you should use the command:

$ make test

If you want to help us or report an issue join to us through the GitHub issue tracker.

Example

It can show all the supported products to be subscribed:

from noaaclass import noaaclass
noaa = noaaclass.connect('username', 'password')
print noaa.subscribe.products()

Then it can create new subscriptions to the gvar_img product:

from noaaclass import noaaclass
noaa = noaaclass.connect('username', 'password')
data = [
    {
        'id': '+',
        'enabled': True,
        'name': '[auto] sample1',
        'north': -26.72,
        'south': -43.59,
        'west': -71.02,
        'east': -48.52,
        'coverage': ['SH'],
        'schedule': ['R'],
        'satellite': ['G13'],
        'channel': [1],
        'format': 'NetCDF',
    },
    {
        'id': '+',
        'enabled': False,
        'name': '[auto] sample2',
        'north': -26.73,
        'south': -43.52,
        'west': -71.06,
        'east': -48.51,
        'coverage': ['SH'],
        'schedule': ['R'],
        'satellite': ['G13'],
        'channel': [2],
        'format': 'NetCDF',
    },
]
noaa.subscribe.gvar_img.set(data)

Next, you can retrieve all the subscriptions to the gvar_img product:

from noaaclass import noaaclass
noaa = noaaclass.connect('username', 'password')
data = noaa.subscribe.gvar_img.get()

Also, you can modify or delete the previous subscriptions:

from noaaclass import noaaclass
noaa = noaaclass.connect('username', 'password')
data = noaa.subscribe.gvar_img.get()
data[1]['name'] = '[auto] name changed!'
data[1]['enabled'] = True
data.pop(0)
data = noaa.subscribe.gvar_img.set(data)

In the other hand, if you want an historic data raise a request:

data = [
    {
        'id': '+',
        'north': -26.72,
        'south': -43.59,
        'west': -71.02,
        'east': -48.52,
        'coverage': ['SH'],
        'schedule': ['R'],
        'satellite': ['G13'],
        'channel': [1],
        'format': 'NetCDF',
        'start': datetime(2014, 9, 16, 10, 0, 0),
        'end': datetime(2014, 9, 16, 17, 59, 59)
    },
    {
        'id': '+',
        'north': -26.73,
        'south': -43.52,
        'west': -71.06,
        'east': -48.51,
        'coverage': ['SH'],
        'schedule': ['R'],
        'satellite': ['G13'],
        'channel': [2],
        'format': 'NetCDF',
        'start': datetime(2014, 9, 2, 10, 0, 0),
        'end': datetime(2014, 9, 3, 17, 59, 59)
    },
]
from noaaclass import noaaclass
noaa = noaaclass.connect('username', 'password')
data = noaa.request.gvar_img.set(data, async=True)

And, if you want to retrieve the requests made in the last 2 hours:

from noaaclass import noaaclass
noaa = noaaclass.connect('username', 'password')
data = noaa.request.gvar_img.get(async=True, hours = 2, append_files=True)

Last, when the site is down you can get the next datetime (in UTC format) in which the website is going to be running:

from noaaclass import noaaclass
noaaclass.next_up_datetime()

About

This software is developed by GERSolar. You can contact us to gersolar.dev@gmail.com.

About

This is a light API to the NOAA CLASS (Comprehensive Large Array-Data Stewardship System).

Resources

License

Stars

Watchers

Forks

Packages

No packages published