forecast module
Methods for generating and plotting a forecast.
- class forecast.Forecast(forecast_dir='./forecast_maps', met_dir='./met_maps', temp_unit='F', wind_unit='mph')
Bases:
object
Class for downloading data from various sources, generating a forecast for a given location, and plotting a forecast. For downloading site data, see self.get_latest_RDPS_astro, self.get_latest_RDPS_met. For generating forecast at a location, see self.forecast_location. For plotting, see self.plot_forecast.
- forecast_dir
directory to store RDPS model astro outputs
- Type:
str
- met_dir
directory to store RDPS model meteorology outputs
- Type:
str
- temp_unit
‘F’ or ‘C’, indicating unit for temperature measurements
- Type:
str
- wind_unit
‘mph’ or ‘km/hr’, indicating unit for wind speed measurements
- Type:
str
- forecast_location(lat, lon, timezone, elevation=0)
Generate forecast for a given location
- Parameters:
lat (float) – latitude of forecast location
lon (float) – longitude of forecast location
pytz.timezone (timezone (str or) – timezone for location
elevation (float) – elevation of location in meters (default: 0)
- Returns:
Forecast data for the given location/timezone
- Return type:
self.forecast (dict)
- static get_closest_grid_point(ds, lat, lon)
Get data at closest point on model grid to given lat/lon (calculated in EPSG 3857 Web Mercator) for xarray ds
- Parameters:
ds (xarray.Dataset) – xarray dataset with ‘latitude’ and ‘longitude’ coordinates
lat (float) – latitude of desired point
lon (float) – longitude of desired point
- Returns:
dataset subset to the grid cell closest to the given lat/lon point.
- Return type:
xarray.Dataset
- plot_forecast()
Plot forecast using matplotlib (must have already run self.forecast_location).