Skip to main content

DT CLIMATE - ENERGY OFFSHORE USE CASE

This is a python package used in the Destination Earth: Digital Twin of Climate simulations project to produce a set of statistics in support of offshore wind farm siting and long term operations. It includes functions for calculating monhtly mean climatologies, monhtly extreme climatologies (includes interannual variability), monhtly weather window climatologies (frequency of suitable conditions to exist)

Installation

After installing the dependencies: Xarray, Dask, Distributed, Matplotlib, Cartopy, and, Numpy

The package can be installed using

pip install EnergyOffshore

Usage

Import using

from EnergyOffshore import EnergyOffshore_analysis_and_visualization as EO

which allows using functions as EO.function_name(function_inputs)

API content

The package includes the following functions


FUNCTIONS
    compute_climatologies(data, config)
        Compute monthly climatologies and save them to netcdf files.

        Input:
	-------
	config: dict, loaded from the configuration.yml file and including
                the names of the desired variables under the key {'var_exceed'}
                and their desired exceedance values. Climatological output
                will be saved under the directory defined by 'data_path' key.

        data:   dict of xr.DataArrays (time,lat,lon). The xr.DataArrays are the daily exceedance
                statistics of a given variable (1-24 if based on hourly data, 0-1 if based on daily data).
                The dict entries are names like 'var_name_exceed_limit' e.g. ws10_exceed_21 for 10 m wind
                exceeding 21 m/s.
        
        Output:
        -------
            
        This function does not return any variables, but instead will save monthly statistics to annual files
        under the directory defined in configuration yml file by the 'data_path' key. 
    
    compute_extreme_climatology(var, quantiles=[0.05, 0.5, 0.95])
        Calculate interannual extemes for each month assuming
        that input array is monthly data
        
        Input:
        ------
        var:       xr.DataArray (time, lat, lon), timeseries of data at any sub-monthly frequency.
        quantiles: List or Array (default=[0.05,0.5,0.95]), specifying the quantiles of interannual variability [0-1]
        
        Output:
        -------
        var_out:   xarray.DataArray (month,lat,lon,quantile), output climatology with quantiles specifying the range of interannual variability
    
    compute_weather_windows(suitable_conditions, windows=[3, 5, 7])
        Determine how likely it is that in a given month
        one will find a weather window (user defined criteria)
        
        Input:
        ----------
        suitable_conditions: xr.DataArray [time,lat,lon], mask [0 or 1]
                             of suitable conditions that match user 
                             defined criteria (float)
        windows: list or numpy.array, weather window lengths in days (int)
        
        Output:
        ----------
        weather_window: xarray.DataArray (month,lat,lon,window), mean monthly likelihood [0-1]
                        of being within the user defined criteria (i.e. not exceeding the criteria)
    
    load_data(config)
        Load data give the config dictionary
        
        Input:
        ------
        config: dict, loaded from the configuration.yml file and including
                the names of the desired variables under the key {'var_exceed'} 
                and their desired exceedance values.  
        
        Output:
        -------
        data: dict of xr.DataArrays (time,lat,lon). The xr.DataArrays are the daily exceedance
              statistics of a given variable (1-24 if based on hourly data, 0-1 if based on daily data).
              The dict entries are names like 'var_name_exceed_limit' e.g. ws10_exceed_21 for 10 m wind
              exceeding 21 m/s.
    
    plot_climatology(climatology, weather_windows, config, plot_name='DT_climate_threshold_exceedance_with_weather_windows.png', plot_windows=True, proj=None, extent=Non
e, levels=None)
        Plot the climatological frequencies of 'suitable conditions' on a map with/without weather windows
        using matplotlib and cartopy.
        
        Input:
        -------
        climatology:     xr.DataArray [time,lat,lon], mean climatology of a given 'suitable condition'
        weather_windows: xarray.DataArray (month,lat,lon,window), mean monthly likelihood [0-1]
                         of being within the user defined criteria (i.e. not exceeding the criteria)
        plot_name:       str, define the name of the plot (including the path)
        plot_windows:    boolean, whether to include weather_window contours on the map (default=True)
        proj:            cartopy map projection (default=None), if not given NearSidePespective centered on
                         northern Europe will be used.
        extent:          list or array [lon_min,lon_max,lat_min,lat_max] (default=None), 
                         if not None will be used to clip the extent of the map (no effect if None)
        
        Output:
        -------
        Does not return variables, but produces a figure in user defined location (plot_name)
    
    plot_climatology_at_location(climatology, extreme_climatology, areas, plot_name)
        Make a climatological plot of given variable at a location. 
        
        Input:
        ------
        climatology: xr.DataArray [time,lat,lon], mean climatology of a given 'suitable condition'
        extreme_climatology: xr.DataArray [time,lat,lon,quantile], 
                             interannual extreme climatology of a given 'suitable condition'.
                             Quantiles are assumed to include [0.05,0.5,0.95].
        
        areas: dict, {area: {'name':'long_name_of_the_area'
                             'lon_slice':[lon_min,lon_max]
                             'lat_slice':[lat_min,lat_max]
                     }}
        plot_name: str, define the name of the plot (including the path)    
        
        Output:
        -------
        
        Does not return variables, but produces a figure in user defined location (plot_name)
    
    preprocess(ds)
        Preprocess a dataset checking for variable 'valid_time' and drop it if found
        
        Input:
        ------
        ds: xarray.Dataset
        
        Output:
        -------
        ds: xarray.Dataset without the variable 'valid_time'
    
    verify_climatology_at_location(climatologies, extreme_climatologies, areas, plot_name)
        Produce a climatology comparing the model output to reanalysis
        
        Input:
        ------
        climatologies: dict of xr.DataArray [time,lat,lon], mean climatologies of a given 'suitable condition'.
                       dict entries are the different conditions for a given model.
        extreme_climatologies: dict xr.DataArray [time,lat,lon,quantile],
                             interannual extreme climatology of a given 'suitable condition'.
                             Quantiles are assumed to include [0.05,0.5,0.95].
                             dict entries are the different conditions for a given model.
        areas: dict, {area: {'name':'long_name_of_the_area'
                             'lon_slice':[lon_min,lon_max]
                             'lat_slice':[lat_min,lat_max]
                     }}.
                     Climatologies will be averaged over these areas.
        plot_name: str, define the name of the plot (including the path)
        
        Output:
        -------
        Does not return variables, but produces a figure in user defined location (plot_name)\

Metadata

Release files for EnergyOffshore 0.3.0

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

Source distribution (sdist)

Source distribution for EnergyOffshore 0.3.0
File Size Uploaded Provenance
energyoffshore-0.3.0.tar.gz 8.7 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 19.5 kB

Release files / energyoffshore-0.3.0.tar.gz

Download URL energyoffshore-0.3.0.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9351c16e15e55a3d77d3015e0a78525141f80a6caa9a4f242bbcd05140d4d845
BLAKE2b-256 checksum
How to use checksums
93be0cc949013630771e17bb93662e828f260d35640f8273323ade8f35abe1be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.13

Release files / energyoffshore-0.3.0-py3-none-any.whl

Download URL energyoffshore-0.3.0-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ea6fcbba5a4ea59b68cf57e64abdda1441cf8b61dbebc446f43e6e4c94148722
BLAKE2b-256 checksum
How to use checksums
0704666159df731cbb0cb52a5f49446f0abafc455917543f6db6d24fb3d02bf2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.13

Security for EnergyOffshore 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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