wavy.ncmod

This module encompasses classes and methods to read and write to netcdf files from model, station, or satellite output. I try to mostly follow the PEP convention for python code style. Constructive comments on style and effecient programming are most welcome!

Module Contents

Functions

check_if_ncfile_accessible(fstr)

read_netcdfs(paths[, dim])

process_one_path_zipped_lru(path, varname, tmpdir)

process_one_path_lru(path, t, varname)

process_one_path(path, t, varname)

read_netcdfs_zipped_lru(paths, varname[, dim])

read_netcdfs_sel_lru(paths, dlst, varname[, dim])

read_netcdfs_sel(paths, dlst, varname[, dim])

get_swim_var_coords(varalias)

read_swim_nc(path, varnamedict)

read_swim_netcdfs(pathlst, varalias)

get_arcmfc_ts(pathtofile)

get_arcmfc_stats(pathtofile)

get_filevarname(varalias, variable_info, srcdict, ncdict)

get_nc_ts(pathtofile, varlst)

get_varlst_from_nc_1D(pathtofile, varlst, sdate, edate)

get_var_from_nc_1D(pathtofile, var, sdate, edate)

dumptonc_ts_insitu(ico, pathtofile, title)

  1. check if nc file already exists

dumptonc_ts_collocation(cco, pathtofile, title)

  1. check if nc file already exists

dumptonc_stats(pathtofile, title, time_dt, time_unit, ...)

  1. check if nc file already exists

dumptonc_ts_sat(sco[, pathtofile, title])

  1. check if nc file already exists

dumptonc_ts_pos(outpath, filename, title, coll_dict)

  1. check if nc file already exists

ncdump(nc_fid[, verb])

Function from:

ncdumpMeta(pathtofile)

Returns dict of netcdf-file content

find_attr_in_nc(attrstr[, pathtofile, ncdict, subattrstr])

fct to find a specific attribute with its value in a netcdf-file

get_varname_for_cf_stdname_in_ncfile(ncdict, stdname)

Attributes

insitu_dict

satellite_dict

variable_info

definition of some global functions

wavy.ncmod.insitu_dict
wavy.ncmod.satellite_dict
wavy.ncmod.variable_info

definition of some global functions

wavy.ncmod.check_if_ncfile_accessible(fstr)
wavy.ncmod.read_netcdfs(paths, dim='time')
wavy.ncmod.process_one_path_zipped_lru(path, varname, tmpdir)
wavy.ncmod.process_one_path_lru(path, t, varname)
wavy.ncmod.process_one_path(path, t, varname)
wavy.ncmod.read_netcdfs_zipped_lru(paths, varname, dim='time')
wavy.ncmod.read_netcdfs_sel_lru(paths, dlst, varname, dim='time')
wavy.ncmod.read_netcdfs_sel(paths, dlst, varname, dim='time')
wavy.ncmod.get_swim_var_coords(varalias)
wavy.ncmod.read_swim_nc(path, varnamedict)
wavy.ncmod.read_swim_netcdfs(pathlst, varalias)
wavy.ncmod.get_arcmfc_ts(pathtofile)
wavy.ncmod.get_arcmfc_stats(pathtofile)
wavy.ncmod.get_filevarname(varalias, variable_info, srcdict, ncdict)
wavy.ncmod.get_nc_ts(pathtofile, varlst)
wavy.ncmod.get_varlst_from_nc_1D(pathtofile, varlst, sdate, edate)
wavy.ncmod.get_var_from_nc_1D(pathtofile, var, sdate, edate)
wavy.ncmod.dumptonc_ts_insitu(ico, pathtofile, title)
  1. check if nc file already exists

    • if so use append mode

    • if not create file and folder structure

wavy.ncmod.dumptonc_ts_collocation(cco, pathtofile, title)
  1. check if nc file already exists

    • if so use append mode

    • if not create file and folder structure

wavy.ncmod.dumptonc_stats(pathtofile, title, time_dt, time_unit, valid_dict)
  1. check if nc file already exists

    • if so use append mode

    • if not create file

wavy.ncmod.dumptonc_ts_sat(sco, pathtofile=None, title=None)
  1. check if nc file already exists

    • if so use append mode

    • if not create file and folder structure

wavy.ncmod.dumptonc_ts_pos(outpath, filename, title, coll_dict)
  1. check if nc file already exists

    • if so use append mode

    • if not create file

wavy.ncmod.ncdump(nc_fid, verb=True)

Function from: http://schubert.atmos.colostate.edu/~cslocum/netcdf_example.html # ncdump outputs dimensions, variables and their attribute information. The information is similar to that of NCAR’s ncdump utility. ncdump requires a valid instance of Dataset. # Parameters ———- nc_fid : netCDF4.Dataset

A netCDF4 dateset object

verbBoolean

whether or not nc_attrs, nc_dims, and nc_vars are printed

# Returns ——- nc_attrs : list

A Python list of the NetCDF file global attributes

nc_dimslist

A Python list of the NetCDF file dimensions

nc_varslist

A Python list of the NetCDF file variables

wavy.ncmod.ncdumpMeta(pathtofile)

Returns dict of netcdf-file content Input: str pointing to netcdf-file Output: dict of attributes

wavy.ncmod.find_attr_in_nc(attrstr, pathtofile=None, ncdict=None, subattrstr=None)

fct to find a specific attribute with its value in a netcdf-file when only a fraction of attribute name is given, can also search in a deeper layer of attribute hierarchy. input: path to the nc-file or ncdict

string of desired attribute string of desired sub-attribute (optional)

output: dict

wavy.ncmod.get_varname_for_cf_stdname_in_ncfile(ncdict, stdname)