reskit.weather.CosmoSource#

Submodules#

Classes#

CosmoSource

Handles the sources Sev created from the COSMO-REA6 dataset (cannot handle the original sources because they're whack)

Package Contents#

class reskit.weather.CosmoSource.CosmoSource(source, bounds=None, indexPad=0, **kwargs)#

Bases: reskit.weather.NCSource.NCSource

Handles the sources Sev created from the COSMO-REA6 dataset (cannot handle the original sources because they’re whack)

Initialize a COSMO style netCDF4 file source

  • Assumes REA6 conventions

Parameters:
  • source (str) – The path to the main data file

  • bounds (Anything acceptable to geokit.Extent.load(), optional) –

    The boundaries of the data which is needed
    • Usage of this will help with memory management

    • If None, the full dataset is loaded in memory

  • padExtent (numeric, optional) –

    The padding to apply to the boundaries
    • Useful in case of interpolation

  • timeBounds (tuple of length 2, optional) –

    Used to employ a slice of the time dimension
    • Expect two pandas Timestamp objects> The first indicates the point to start collecting data, and the second indicates the end

GWA50_CONTEXT_MEAN_SOURCE = None#
GWA100_CONTEXT_MEAN_SOURCE = None#
MAX_LON_DIFFERENCE = 0.6#
MAX_LAT_DIFFERENCE = 0.6#
loc2Index(loc, outsideOkay=False, asInt=True)#

Returns the closest X and Y indexes corresponding to a given location or set of locations

Parameters:
  • loc (Anything acceptable by geokit.LocationSet) –

    The location(s) to search for * A single tuple with (lon, lat) is acceptable, or a list of such tuples * A single point geometry (as long as it has an SRS), or a list

    of geometries is okay

    • geokit,Location, or geokit.LocationSet are best!

  • outsideOkay (bool, optional) – Determines if points which are outside the source’s lat/lon grid are allowed * If True, points outside this space will return as None * If False, an error is raised

Returns:

  • If a single location is given (tuple) –

    • Format: (yIndex, xIndex)

    • y index can be accessed with ‘.yi’

    • x index can be accessed with ‘.xi’

  • If multiple locations are given (list) –

    • Format: [ (yIndex1, xIndex1), (yIndex2, xIndex2), …]

    • Order matches the given order of locations

loadRadiation()#

frankCorrection: ‘Bias correction of a novel European reanalysis data set for solar energy applications’

loadWindSpeedLevels()#
loadWindSpeedAtHeight(height=100)#

NEEDS UPDATING!

loadTemperature(processor=lambda x: ...)#

Load the typical pressure variable

loadPressure()#

Load the typical pressure variable

loadSet_PV(verbose=False, _clockstart=None, _header='')#
getWindSpeedAtHeights(locations, heights, spatialInterpolation='near', forceDataFrame=False, outsideOkay=False, _indicies=None)#

Retrieve complete time series for a variable from the source’s loaded data table at the given location(s)

Parameters:
  • locations (Anything acceptable by geokit.LocationSet) –

    The location(s) to search for
    • A single tuple with (lon, lat) is acceptable, or a list of such tuples

    • A single point geometry (as long as it has an SRS), or a list of geometries is okay

    • geokit,Location, or geokit.LocationSet are best, though

  • spatialInterpolation (str, optional) –

    The interpolation method to use
    • ’near’ => For each location, extract the time series at the closest lat/lon index

    • ’bilinear’ => For each location, use the time series of the surrounding +/- 1 index locations to create an estimated time series at the given location using a biliear scheme

    • ’cubic’ => For each location, use the time series of the surrounding +/- 2 index locations to create an estimated time series at the given location using a cubic scheme

  • forceDataFrame – Instructs the returned value to take the form of a DataFrame regardless of how many locations are specified

Returns:

  • If a single location is given (pandas.Series) –

    • Indexes match to times

  • If multiple locations are given (pandas.DataFrame) –

    • Indexes match to times

    • Columns match to the given order of locations