gcpy.examples.working_with_files.add_blank_var_to_restart_file

Example program to add a variable containing all zeroes to an xarray Dataset object. Useful when you have to insert new species into GEOS-Chem diagnostic or restart files.

Examples

  1. Copy this file to a different folder and navigate to that folder.

  2. In your copy, edit atttributes and file names for your use case.

  3. Run the following commands:

$ conda activate gcpy_env
(gcpy_env) $ ./regrid_restart_ll_to_cs.py

Functions

add_blank_var_to_ncfile(varname, infile, outfile)

Adds a variable containing all zeroes to a netCDF file.

main()

Main program

gcpy.examples.working_with_files.add_blank_var_to_restart_file.add_blank_var_to_ncfile(varname, infile, outfile, varattrs=None)[source]

Adds a variable containing all zeroes to a netCDF file.

Parameters:
  • varname (str) – Name of the variable to add.

  • infile (str) – Name of the input netCDF file (will not be overwritten).

  • outfile (str) – Name of the output netCDF file containing varname.

  • varattrs (dict, optional) – A dictionary containing netCDF variable attributes to be written to outfile.

gcpy.examples.working_with_files.add_blank_var_to_restart_file.main()[source]

Main program