earth2mip.initial_conditions package#

Submodules#

earth2mip.initial_conditions.base module#

class earth2mip.initial_conditions.base.DataSource(*args, **kwargs)#

Bases: Protocol

property channel_names: List[str]#
grid: LatLonGrid#

earth2mip.initial_conditions.cds module#

class earth2mip.initial_conditions.cds.DataSource(channel_names: List[str], client: cdsapi.api.Client = <factory>, _cache: Optional[str] = None)#

Bases: object

Parameters:
  • channel_names (List[str]) –

  • client (Client) –

  • _cache (str | None) –

property cache#
channel_names: List[str]#
client: Client#
property grid: LatLonGrid#
property time_means#
class earth2mip.initial_conditions.cds.PressureLevelCode(id: int, level: int = 0)#

Bases: object

Parameters:
  • id (int) –

  • level (int) –

id: int#
level: int = 0#
class earth2mip.initial_conditions.cds.SingleLevelCode(id: int)#

Bases: object

Parameters:

id (int) –

id: int#
earth2mip.initial_conditions.cds.keys_to_vals(d)#
earth2mip.initial_conditions.cds.parse_channel(channel)#
Parameters:

channel (str) –

Return type:

PressureLevelCode | SingleLevelCode

earth2mip.initial_conditions.gfs module#

class earth2mip.initial_conditions.gfs.DataSource(channels)#

Bases: DataSource

Parameters:

channels (List[str]) –

property channel_names: List[str]#
property grid: LatLonGrid#
class earth2mip.initial_conditions.gfs.GFSChunk(variable_name: str = 'phoo', meta_data: str = '', start_byte: int = 0, end_byte: int = 0)#

Bases: object

Parameters:
  • variable_name (str) –

  • meta_data (str) –

  • start_byte (int) –

  • end_byte (int) –

property byte_range: int#
property channel_id: str#
end_byte: int = 0#
meta_data: str = ''#
start_byte: int = 0#
variable_name: str = 'phoo'#
earth2mip.initial_conditions.gfs.get(time, gfs_channels)#
Parameters:
  • time (datetime | None) –

  • gfs_channels (List[str]) –

Return type:

ndarray

earth2mip.initial_conditions.gfs.get_gfs_chunks(time)#
Parameters:

time (datetime) –

earth2mip.initial_conditions.gfs.get_gfs_grib_file(time, gfs_chunks, channel_id, output_file)#
Parameters:
  • time (datetime) –

  • gfs_chunks (List[GFSChunk]) –

  • channel_id (str) –

  • output_file (str) –

earth2mip.initial_conditions.gfs.gfs_available(time)#
Parameters:

time (datetime) –

Return type:

bool

earth2mip.initial_conditions.hdf5 module#

class earth2mip.initial_conditions.hdf5.DataSource(root, metadata, channel_names=None)#

Bases: DataSource

HDF5 Data Sources

Works with a directory structure like this:

data.json
subdirA/2018.h5
subdirB/2017.h5
subdirB/2016.h5

data.json should have fields

h5_path - the name of the data within the hdf5 file coords.channel - list of channels coords.lat - list of lats coords.lon - list of lons dhours - timestep in hours (default 6 hours)

Parameters:
  • root (str) –

  • metadata (Any) –

  • channel_names (List[str] | None) –

property channel_names#
classmethod from_path(root, **kwargs)#
Parameters:
  • root (str) –

  • kwargs (Any) –

Return type:

DataSource

property grid#
property time_means#
earth2mip.initial_conditions.hdf5.open_xarray(time)#
Parameters:

time (datetime) –

Return type:

DataArray

earth2mip.initial_conditions.hrmip module#

class earth2mip.initial_conditions.hrmip.HDFPlSl(path)#

Bases: DataSource

Parameters:

path (str) –

property channel_names: List[str]#
property grid: LatLonGrid#

earth2mip.initial_conditions.ifs module#

class earth2mip.initial_conditions.ifs.DataSource(channel_names: List[str])#

Bases: DataSource

Parameters:

channel_names (List[str]) –

property channel_names: List[str]#
property grid: LatLonGrid#
earth2mip.initial_conditions.ifs.get(time, channels)#
Parameters:
  • time (datetime) –

  • channels (List[str]) –

Module contents#

earth2mip.initial_conditions.get_data_source(channel_names, netcdf='', initial_condition_source=InitialConditionSource.era5)#
Parameters:

channel_names (List[str]) –

Return type:

DataSource