observing_conditions#
Methods for dealing with observing conditions.
- class hsr4hci.observing_conditions.ObservingConditions[source]#
This class provides a wrapper around different representations of the observing conditions (dictionary, numpy array and pandas data frame), and provides the option to select a subset of them.
- Parameters:
observing_conditions – The observing conditions in the form of a dictionary where each key maps onto a 1D numpy array that contains, for example, the wind speed.
- as_array(selected_keys='all')[source]#
Return the subset of observing conditions selected by
selected_keysas a numpy array.- Parameters:
selected_keys (Optional[Union[List[str], str]]) – A valid specification of a subset of observing conditions. Either None (to select no OC at all), or a list of keys, or “all” (to select all available observing conditions).
- Returns:
A 2D numpy array of shape (n_frames, n_obscon) containing the selected observing conditions.
- Return type:
- as_dataframe(selected_keys='all')[source]#
Return the subset of observing conditions selected by
selected_keysas a pandas data frame.- Parameters:
selected_keys (Optional[Union[List[str], str]]) – A valid specification of a subset of observing conditions. Either None (to select no OC at all), or a list of keys, or “all” (to select all available observing conditions).
- Returns:
A pandas data frame containing the selected observing conditions.
- Return type:
- as_dict(selected_keys='all')[source]#
Return the subset of observing conditions selected by
selected_keysas a dictionary.- Parameters:
selected_keys (Optional[Union[List[str], str]]) – A valid specification of a subset of observing conditions. Either None (to select no OC at all), or a list of keys, or “all” (to select all available observing conditions).
- Returns:
A dictionary containing the selected observing conditions.
- Return type:
- hsr4hci.observing_conditions.get_observing_conditions(parameter_name, timestamps)[source]#
This is a convenience wrapper to query the ESO ambient condition archives for a given parameter, interpolate the results, and evaluate them at the requested
timestamps.- Parameters:
parameter_name (str) – Name of the parameter to retrieve from the archive. This needs to be resolvable into a parameter key and archive by
resolve_parameter_name().timestamps (ndarray) – A 1D numpy array of floats, containing the UTC timestamps of the frames in the stack.
- Returns:
A 1D numpy array with shape (n_frames, ) which contains an interpolated value of the target parameter for every frame.
- Return type:
- hsr4hci.observing_conditions.interpolate_observing_conditions(timestamps, df, parameter_key)[source]#
Take the values of the observing conditions in the data frame
dfand interpolate them temporally so that we get values for the timestamp of each frame.The interpolation procedure is based on Cubic splines. See https://stats.stackexchange.com/a/511394 for the original idea.
- Parameters:
timestamps (ndarray) – A 1D numpy array of floats, containing the UTC timestamps of the frames in the stack.
df (DataFrame) – A data frame containing the result from querying one of the ESO archives (e.g.,
query_meteo()).parameter_key (str) – The key under which a parameter is available from the respective archive. (See also
query_archive()).
- Returns:
A 1D numpy array with shape (n_frames, ) which contains an interpolated value of the target parameter for every frame.
- Return type:
- hsr4hci.observing_conditions.query_archive(start_date, end_date, archive, parameter_key)[source]#
Send a request to one of ESO’s ambient condition query forms [1] to retrieve the values of a particular observing condition.
[1]: https://archive.eso.org/cms/eso-data/ambient-conditions/paranal-ambient-query-forms.html
- Parameters:
start_date (str) – The start datetime (in UTC) as a string in ISO 8061 format. Example: “2012-12-20T20:00:00.0000”.
end_date (str) – The end datetime (in UTC) as a string in ISO 8061 format. Example: “2012-12-21T10:00:00.0000”.
archive (str) –
The name of the archive to which to send the query. Currently, the following archives are supported:
”meteo”
”dimm_old”
”dimm_new”
”mass”
”lhatpro”
”lhatpro_irt”
See [1] for more information about these archives.
parameter_key (str) – The key under which a parameter is available from the respective archive. These keys can be reverse-engineered from the source code of the respective archive. For example, “press” will get you the air pressure, or more precisely, the “temporal (1 minute) mean of observatory site ambient barometric air pressure measured at ground during measurement period [hPa].” For the default parameters,
resolve_parameter_name()will resolve “intuitive” parameter names (such as, e.g., “air_pressure”) to the correct, archive-specific keys.
- Returns:
A data frame with the datetime and timestamp, the integration time (in seconds) and the value of the requested parameter averaged over the integration time.
- Return type:
- hsr4hci.observing_conditions.resolve_parameter_name(parameter_name, obs_date)[source]#
Resolves a
parameter_nameinto a dictionary that contains information about which archive the parameter can be obtained from, using which parameter_key.- Parameters:
- Returns:
A 3-tuple (archive, parameter_key, description) which tells us from which ESO ambient server we can retrieve the parameter and which key we have to use for the query.
- Return type: