IO API

Input and output from netCDF-SCM’s netCDF format

netcdf_scm.io.get_scmcube_helper(drs)[source]

Get ScmCube helper for a given data reference syntax

drsstr

Data reference syntax to get the helper cube for

Returns

Instance of sub-class of netcdf_scm.iris_cube_wrappers.ScmCube which matches the input data reference syntax

Return type

netcdf_scm.iris_cube_wrappers.ScmCube

Raises
netcdf_scm.io.load_mag_file(infile, drs)[source]

Load .MAG file with automatic infilling of metadata if possible

Parameters
  • infile (str) – File to load (use the full path for best results as this is used to determine the metadata)

  • drs (str) – Data reference syntax to use with this file

Returns

pymagicc.io.MAGICCData with the data and metadata contained in the file.

Return type

pymagicc.io.MAGICCData

Warns

UserWarning – Some or all of the metadata couldn’t be determined from infile with the given drs.

netcdf_scm.io.load_scmrun(path)[source]

Load an scmdata.ScmRun instance from a netCDF-SCM .nc file

Parameters

path (str) – Path from which to load the data

Returns

scmdata.ScmRun containing the data in path.

Return type

scmdata.ScmRun

netcdf_scm.io.save_netcdf_scm_nc(cubes, out_path)[source]

Save a series of cubes to a .nc file

Parameters
  • cubes (dict) – Dictionary of “region name”-ScmCube key-value pairs. The cubes will all be saved in the same .nc file.

  • out_path (str) – Path in which to save the data