Model
The aim of the following utilities is to request and interpret (forecast) data from Numerical Weather Prediction models
ECMWF
mwr_l12l2.model.ecmwf.req_ecmwf
This module is concerned with requesting operational forecast data from the ECMWF model
- mwr_l12l2.model.ecmwf.request_ecmwf.get_corner_coord(stn_coord, offset, resol)[source]
get corners of a coordinate box around station coordinates which match model grid points
- mwr_l12l2.model.ecmwf.request_ecmwf.get_from_mars(request_file)[source]
run mars request as a child process that will continue running even if function here is exited
- mwr_l12l2.model.ecmwf.request_ecmwf.main(**kwargs)[source]
write mars request and get according model data from ECMWF using the mars command
- Parameters:
**kwargs – keyword arguments passed on to
write_mars_request(). Request file must not be specified!
- mwr_l12l2.model.ecmwf.request_ecmwf.write_mars_request(request_file, mars_conf_fc, mars_conf_z, inst_conf_path, inst_conf_file_pattern='config_0*.yaml', update_interval=6, availability_offset=6.5)[source]
write request file for getting ECMWF model data using ‘mars’ for all stations that have a valid config file
The function will use the current time to infer what is the expeceted issuing date of the last forecast. For dissemination time of ECMWF forecasts see https://confluence.ecmwf.int/display/DAC/Dissemination+schedule
- Parameters:
request_file – file to be generated by this function to configure mars request
mars_conf_fc – yaml config file (or dictionary) defining the request of forecast data
mars_conf_z – yaml config file (or dictionary) defining the request of geopotential on lowest level from analysis
inst_conf_path – directory where to look for instrument config files
inst_conf_file_pattern (optional) – filename pattern that inst config files match. Defaults to ‘config_0*.yaml’
update_interval (optional) – interval of new forecasts becoming available in hours
availability_offset (optional) – delay after which a new forecast becomes available in hours
mwr_l12l2.model.ecmwf.interpret_ecmwf
This module interprets forecast data obtained from the ECMWF model
- class mwr_l12l2.model.ecmwf.interpret_ecmwf.ModelInterpreter(file_fc_nc, file_zg_grb=None, station_altitude=None, file_ml=None)[source]
Bases:
objectclass to interpret model data from ECMWF and produce input files for TROPoe
- Parameters:
file_fc_nc – file containing forecast data in NetCDF. Must have been converted from grib to nc with mwr_l12l2/model/ecmwf/grb_to_nc.sh before. Direct read-in of grib doesn’t work because of dim of lnsp
file_zg_grb – file containing the geopotential of the lowest model level in grib format
station_altitude (optional) – Station altitude to inter/extrapolate model data to for sfc data. If not specified the lowest model level will be used for surface data.
file_ml (optional) – a and b parameters to transform model levels to pressure and altitude grid. If not specified the file named ‘ecmwf_model_levels_137.csv’ in same dir as interpret_ecmwf.py will be used.
- hybrid_to_p()[source]
compute pressure (in Pa) of half and full levels from hybrid levels and fill to self.p and self.p_half
- load_data(time_min, time_max)[source]
load dataset and reduce to the time of interest (to speed up following computations)
- p_to_z()[source]
transform pressure grid (from
hybrid_to_p()) to geometrical altitudes
- relative_humidity()[source]
return relative humidity from pressure, specific humitiy and temperature in self.rh according to https://codes.ecmwf.int/grib/param-db/?id=157
- run(time_min, time_max)[source]
run for data closest to selected time in
numpy.datetime64ordatetime.datetime
- mwr_l12l2.model.ecmwf.interpret_ecmwf.get_ref_profile(x)[source]
extract ref profile (last time, centre lat/lon) from a
xarray.DataArraywith dim (time,level,lat,lon)
- mwr_l12l2.model.ecmwf.interpret_ecmwf.get_std_profile(x)[source]
extract std profile (last time, std in lat/lon) from a
xarray.DataArraywith dim (time,level,lat,lon)