Skip to main content

getgfs

TestsBlack LintingDOI

Logo - Cloud with sun emerging from behind with text 'GetGFS' underneath

getgfs extracts weather forecast variables from the NOAA GFS forecast in a pure python, no obscure dependencies way. Currently you can:

  • "Connect" to a forecast
  • Search the variables
  • Download variables for any time range, longitude, latitude and altitude
  • Download "wind profiles" where you get an interpolation object for the u and v wind components by altitude

For full documentation please see the docs

Installing

Installation is simple with PyPi:

pip install getgfs

Requirements

The required libraries (installed by PyPi) are:

scipy, requests, fuzzywuzzy, numpy, python_dateutil, regex

I have tried to ensure that these are well maintained and work across platforms (as this was the motive for writing this library).

About

The incentive to write this library was that the current method to get any variable was to download and extract information from a grib file. This requires you to use the ECMWF's ecCodes which doesn't work on Windows. To get around this the OpenDAP version of the forecast is used and a custom decoder reads the downloaded files.

Previous Python projects that attempted this do not fulfil all the requirements, mainly being an importable library. Acknowledgment must be made to albertotb's project get-gfs for providing the first foothold along the way.

Usage

The library is straight forward to use. To get started create a Forecast object by:

>>>import getgfs
>>>f=getgfs.Forecast("0p25")

You can choose the resolution to be 0p25, 0p50 or 1p00 and for the 0p25 forecast you can optional specify a shorter time step by adding 1hr after.

First to find what variable you are looking for use the search function, for example if I want the wind speed I could search for "wind":

>>>f.search("wind")
[('gustsfc', '** surface wind speed (gust) [m/s] ', 100), ('ugrdprs', '** (1000 975 950 925 900.. 7 5 3 2 1) u-component of wind [m/s] ', 125), ('ugrd_1829m', '** 1829 m above mean sea level u-component of wind [m/s] ', 125), ...

So now I can see I might want "gustsfc". Now if I want the wind speed at N70.1 W94.7 at 5:30 on the 27th of February (only forecasts going back around a week are available and future times available depend on the forecast - look for f.times) I could do:

>>>res=f.get(["gustsfc"],"20210227 5:30", 70.1,-94.7)
>>>res.variables["gustsfc"].data
array([[[18.808477]]])

You can get more information (e.g. what is the units of this) by exploring the variables information

{'_FillValue': 9.999e+20, 'missing_value': 9.999e+20, 'long_name': '** surface wind speed (gust) [m/s] ', 'level_dependent': False}

You can also get multiple variables by including more names in the list or a range of positions by using "'[min_lat:max_lat]'" type strings in place of the position parameters.

Contributing

Please see contributing for more information.

Todo

Metadata

Release files for getgfs 1.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for getgfs 1.2.0
File Interpreter ABI Platform
getgfs-1.2.0-py3-none-any.whl Python 3 none any Details

Release files / getgfs-1.2.0-py3-none-any.whl

Download URL getgfs-1.2.0-py3-none-any.whl
Size 33.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
18230c498420d6878f93ace97a3cde2ad85c3db51ae04dd617f11b29f8937461
BLAKE2b-256 checksum
How to use checksums
fd54b9dc28898e1a96fa011b251dd37acfc5abd4ee3200adf2d2f2fdd054235a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.2.0 This release

1 release file

1.1.0

1 release file

1.0.0

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

0.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page