wavy.model_module ================= .. py:module:: wavy.model_module .. autoapi-nested-parse:: The main task of this module is to acquire, read, and prepare geophysical variables from model output files for further use. Attributes ---------- .. autoapisummary:: wavy.model_module.model_dict wavy.model_module.variable_def Classes ------- .. autoapisummary:: wavy.model_module.model_class Functions --------- .. autoapisummary:: wavy.model_module.crop_to_period wavy.model_module.check_date wavy.model_module.generate_bestguess_leadtime wavy.model_module.read_model_nc_output_lru Module Contents --------------- .. py:function:: crop_to_period(ds, sd, ed) Function to crop the dataset to a given period .. py:function:: check_date(filelst, date) Checks if str in lst according to desired date (sd, ed) return: idx for file .. py:function:: generate_bestguess_leadtime(model, fc_date, lidx=None, **kwargs) fct to return leadtimes for bestguess .. py:function:: read_model_nc_output_lru(filestr, lonsname, latsname, timename) .. py:data:: model_dict .. py:data:: variable_def .. py:class:: model_class(**kwargs) Bases: :py:obj:`wavy.quicklookmod.quicklook_class_sat` class to read and process model data model: e.g. Hs[time,lat,lon], lat[rlat,rlon], lon[rlat,rlon] This class should communicate with the satellite, model, and station classes. .. py:attribute:: sd .. py:attribute:: ed .. py:attribute:: nID .. py:attribute:: model .. py:attribute:: varalias .. py:attribute:: units .. py:attribute:: stdvarname .. py:attribute:: distlim .. py:attribute:: filter .. py:attribute:: region .. py:attribute:: leadtime .. py:attribute:: cfg .. py:method:: crop_to_period(**kwargs) Function to crop the variable dictionary to a given period .. py:method:: get_item_parent(item, attr) Offers possibility to explore netcdf meta info. by specifying what you are looking for (item), e.g. part of a string, and in which attribute (attr), e.g. standard_name, this function returns the parent parameter name of the query string. param: item - (partial) string e.g. [m] attr - attribute e.g. units return: list of matching parameter strings e.g. for satellite_class object sco: .. code :: sco.get_item_parent('m','units') .. py:method:: get_item_child(item) Gets all attributes connected to given parameter name. param: item - (partial) string e.g. [m] return: matching parameter string e.g. for satellite_class object sco: .. code :: sco.get_item_child('time') .. py:method:: _get_model_filedate(fc_date, leadtime, **kwargs) get init_date for latest model output file and checks if available param: fc_date - datetime object leadtime - integer in hours return: suitable datetime to create model filename .. py:method:: _make_model_filename(fc_date, leadtime, **kwargs) creates/returns filename based on fc_date,leadtime param: fc_date - datetime object leadtime - integer in hours return: filename (consists of path + filename) comment: - special characters are escaped by adding "\" - the escapes need to be removed for certain libraries like xarray and netCDF4 .. py:method:: _make_model_filename_wrapper(fc_date, leadtime, **kwargs) Wrapper function of make_model_filename. Organizes various cases. param: model - modelname type(str) fc_date - datetime object leadtime - integer in hours return: filename .. py:method:: _make_list_of_model_filenames(fc_dates, lt, **kwargs) return: flst - list of model files to be opened dlst - list of dates to be chosen within each file .. py:method:: _get_files(dict_for_sub=None, path=None, wavy_path=None, **kwargs) Function to retrieve list of files/paths for available locally stored data. This list is used for other functions to query and parsing. param: sd - start date (datetime object) ed - end date (datetime object) nID - nID as of model_cfg.yaml dict_for_sub - dictionary for substitution in templates path - a path if defined return: pathlst - list of paths filelst - list of files .. py:method:: list_input_files(show=False, **kwargs) .. py:method:: _get_model(**kwargs) Main function to obtain data from satellite missions. reads files, apply region and temporal filter return: adjusted dictionary according to spatial and temporal constraints .. py:method:: _enforce_longitude_format(**kwargs) .. py:method:: _enforce_meteorologic_convention(**kwargs) .. py:method:: _change_varname_to_aliases(**kwargs) .. py:method:: _change_stdvarname_to_cfname(**kwargs) .. py:method:: populate(**kwargs)