3.4.1. pypago.nc

Module that contains various functions dedicated to the conversion of PyPAGO outputs into NetCDF files` to .nc files

Functions

gridsec_tonc(finname, varname[, …]) Conversion of tracer and velocities along the sections into NetCDF.
gridvol_tonc(finname, varname[, …]) Conversion of tracer fields within a domain into NetCDF.
secind_tonc(finname[, section_names]) Conversion of section indices (issued from pypago.pypago.indices_MODEL() function) in NetCDF.
sections_tonc(finname[, section_names]) Extraction of sections’ endpoints into NetCDF files

Classes

Dataset A netCDF netCDF4.Dataset is a collection of dimensions, groups, variables and attributes.
pypago.nc.gridsec_tonc(finname, varname, section_names=None, units='days since 1900-01-01 00:00:00', calendar='gregorian')

Conversion of tracer and velocities along the sections into NetCDF. There will be one file per section, in which the variables will be saved. The absolute path of the output files will be the same as for the input file name, except that the .pygo will be replaced by _sec_SECTIONNAME.nc

Parameters:
  • finname (str) – output of the pypago.loaddata.loaddata() function (must contain a dictionary with the MODEL_sections and MODEL_time keys)
  • section_names (list) – Default is None. If set, the list of the sections’ names from which to extract the data
  • varname (list) – Default is None. If None, all the variables (vect, vecs and vecv are extracted. If set, the list of the variables names to extract
pypago.nc.gridvol_tonc(finname, varname, domain_names=None, units='days since 1900-01-01 00:00:00', calendar='gregorian')

Conversion of tracer fields within a domain into NetCDF. There will be one file per domain, in which the variables will be saved. The absolute path of the output files will be the same as for the input file name, except that the .pygo will be replaced by _dom_DOMAINNAME.nc

Parameters:
  • finname (str) – output of the pypago.loaddata.loaddata() function (must contain a dictionary with the MODEL_areas and MODEL_time keys)
  • domain_names (list) – Default is None. If set, the list of the domains’ names from which to extract the data
  • varname (list) – Default is None. If None, all the variables (temperature, salinity) are extracted. If set, the list of the variables names to extract
pypago.nc.secind_tonc(finname, section_names=None)

Conversion of section indices (issued from pypago.pypago.indices_MODEL() function) in NetCDF.

Parameters:
  • finname (str) – output of the pypago.pypago.indices_MODEL() function
  • section (str) – Default is None. If set, the section to extract
pypago.nc.sections_tonc(finname, section_names=None)

Extraction of sections’ endpoints into NetCDF files

Parameters:
  • finname (str) – filename containing the list of sections’ endpoints (output of the pypago.guis.gui_sections_edition)
  • section_names (list) – Default is None. If set, the list of sections’ names from which to extract the endpoints

Convert all sections of sections_NA_Nico.pygo to individual NetCDF files: >>> _sections_tonc(‘sections_NA_Nico.pygo’)

Convert only ar7 section >>> _sections_tonc(‘sections_NA_Nico.pygo’, section_names=[‘ar7’])

What append if missing file ? >>> _sections_tonc(‘badfile’)

What append if missing section name in the file ? >>> _sections_tonc(‘sections_NA_Nico.pygo’, section_names=[‘badsection’])