API

接口

绘制图片

sokort.draw_plot(system: str, plot_type: str, start_time: Union[str, datetime.datetime, pandas._libs.tslibs.timestamps.Timestamp], forecast_time: Optional[Union[str, pandas._libs.tslibs.timedeltas.Timedelta]] = None, data_directory: Optional[Union[str, pathlib.Path]] = None, work_directory: Optional[Union[str, pathlib.Path]] = None, verbose: Union[bool, int] = False, **kwargs)

Draw images and save them in work directory.

参数
  • system (str) –

  • plot_type (str) – Plot type according to systems.

  • start_time (str or datetime.datetime or pd.Timestamp) –

    Start time:
    • str: YYYYMMDDHH or other strings supported by pandas.to_datetime

    • datetime.datetime or pd.Timestamp

  • forecast_time (str or pd.Timedelta) – Forecast time duration, such as 3h.

  • data_directory – Dir for model GIRB2 data.

  • work_directory – Dir to run plot script.

  • verbose – print setting

引发

ValueError – plot_type is not found

绘制并显示图片

sokort.show_plot(system: str, plot_type: str, start_time: Union[str, datetime.datetime, pandas._libs.tslibs.timestamps.Timestamp], forecast_time: Union[str, pandas._libs.tslibs.timedeltas.Timedelta], presenter: sokort._presenter.Presenter = <sokort._presenter.IPythonPresenter object>, data_directory: Optional[Union[str, pathlib.Path]] = None, work_directory: Optional[Union[str, pathlib.Path]] = None, verbose: Union[bool, int] = False, **kwargs)

Draw images and show them in Jupyter Notebook.

参数
  • system

  • plot_type (str) – Plot type according to systems.

  • start_time (str or datetime.datetime or pd.Timestamp) –

    Start time:
    • str: YYYYMMDDHH, or other time strings (supported by pd.to_datetime)

    • datetime.datetime or pd.Timestamp

  • forecast_time (str or pd.Timedelta) – Forecast time duration, such as 3h.

  • presenter (Presenter) – image presenter

  • data_directory

  • work_directory

  • verbose

引发

ValueError – plot_type is not found

底层

class sokort._plotter.BasePlotter(task: Dict, work_dir: Union[str, pathlib.Path], config: Dict, verbose: Union[bool, int] = False, **kwargs)

Base plotter for all plot engines.

get_image_list() List

Get image list.

Should implemented by sub-class.

返回

image_list – Image list.

返回类型

list

run_plot()

Run process to draw plot in work_dir.

class sokort._plotter.NclPlotter(task: Dict, work_dir: Union[str, pathlib.Path], config: Dict, verbose: Union[bool, int] = False, **kwargs)

Base class for plotter using NCL.

class sokort._plotter.PythonPlotter(task: Dict, work_dir: Union[str, pathlib.Path], config: Dict, verbose: Union[bool, int] = False, **kwargs)