Skip to content

Latest commit

 

History

History
26 lines (17 loc) · 1.31 KB

tools.rst

File metadata and controls

26 lines (17 loc) · 1.31 KB

Tools

Some additional tools are provided with the library.

Benchmarking

pysd.tools.benchmarking

Exporting netCDF data_vars to csv or tab

Simulation results can be stored as netCDF (.nc) files (see Storing simulation results on a file <./getting_started>).

The :pypysd.tools.ncfiles.NCFile allows loading netCDF files generated with PySD as an :pyxarray.Dataset. When passing the argument parallel=True to the constructor, :pyxarray.DataArray inside the Dataset will be loded as dask arrays, with chunks=-1.

Once the Dataset is loaded, a subset (or all) of the data_vars can be exported into:

  • A :pypandas.DataFrame, using the :pypysd.tools.ncfiles.NCFile.to_df method
  • A *.csv or *.tab files, using the the :pypysd.tools.ncfiles.NCFile.to_text_file method

Alternatively, to get further control of the chunking, users can load the :pyxarray.Dataset using :pyxarray.open_dataset and then use the :pypysd.tools.ncfiles.NCFile.ds_to_df or :pypysd.tools.ncfiles.NCFile.df_to_text_file static methods.

pysd.tools.ncfiles