wavy.ncmod ========== .. py:module:: wavy.ncmod .. autoapi-nested-parse:: 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! Attributes ---------- .. autoapisummary:: wavy.ncmod.insitu_dict wavy.ncmod.satellite_dict wavy.ncmod.variable_info Functions --------- .. autoapisummary:: wavy.ncmod.check_if_ncfile_accessible wavy.ncmod.read_netcdfs wavy.ncmod.build_usr_pw_path wavy.ncmod.read_netcdfs_with_credentials_aggregated wavy.ncmod.read_netcdfs_naive wavy.ncmod.process_one_path_netCDF4 wavy.ncmod.consolidate_darrays wavy.ncmod.build_xr_ds wavy.ncmod.build_xr_ds_multivar wavy.ncmod.build_xr_ds_from_dict wavy.ncmod.read_netcdfs_KF wavy.ncmod.read_mf_netcdfs wavy.ncmod.process_one_path_lru wavy.ncmod.process_one_path wavy.ncmod.read_netcdfs_sel_lru wavy.ncmod.read_netcdfs_sel wavy.ncmod.get_swim_var_coords wavy.ncmod.read_swim_nc wavy.ncmod.read_swim_netcdfs wavy.ncmod.get_arcmfc_ts wavy.ncmod.get_arcmfc_stats wavy.ncmod.get_filevarname wavy.ncmod.get_filevarname_list wavy.ncmod.get_nc_ts wavy.ncmod.get_varlst_from_nc_1D wavy.ncmod.dumptonc_stats wavy.ncmod.ncdump wavy.ncmod.ncdumpMeta wavy.ncmod.find_attr_in_nc wavy.ncmod.get_varname_for_cf_stdname_in_ncfile Module Contents --------------- .. py:data:: insitu_dict .. py:data:: satellite_dict .. py:data:: variable_info definition of some global functions .. py:function:: check_if_ncfile_accessible(fstr, **kwargs) .. py:function:: read_netcdfs(paths, dim='time', decode_times=None, use_cftime=None, **kwargs) .. py:function:: build_usr_pw_path(path, remoteHostName, usr, pw) .. py:function:: read_netcdfs_with_credentials_aggregated(path, remoteHostName, usr, pw, decode_times=None, use_cftime=None) .. py:function:: read_netcdfs_naive(paths, varnames, varalias, **kwargs) .. py:function:: process_one_path_netCDF4(path: str, varnames: dict, varalias: str) .. py:function:: consolidate_darrays(darrays: list) -> numpy.ndarray .. py:function:: build_xr_ds(darray: numpy.ndarray, varnames: dict, varalias: str) .. py:function:: build_xr_ds_multivar(darray: numpy.ndarray, varnames: dict, varalias: list) .. py:function:: build_xr_ds_from_dict(dict_var, var_name_ref) .. py:function:: read_netcdfs_KF(paths, dim='time') .. py:function:: read_mf_netcdfs(paths) .. py:function:: process_one_path_lru(path, t, varname) .. py:function:: process_one_path(path, t, varname) .. py:function:: read_netcdfs_sel_lru(paths, dlst, varname, dim='time', **kwargs) .. py:function:: read_netcdfs_sel(paths, dlst, varname, dim='time', **kwargs) .. py:function:: get_swim_var_coords(varalias) .. py:function:: read_swim_nc(path, varnamedict) .. py:function:: read_swim_netcdfs(pathlst, varalias) .. py:function:: get_arcmfc_ts(pathtofile) .. py:function:: get_arcmfc_stats(pathtofile) .. py:function:: get_filevarname(varalias, variable_info, srcdict, ncdict, **kwargs) .. py:function:: get_filevarname_list(varalias, variable_info, srcdict, ncdict, **kwargs) .. py:function:: get_nc_ts(pathtofile, varlst, **kwargs) .. py:function:: get_varlst_from_nc_1D(pathtofile, varlst, sdate, edate) .. py:function:: dumptonc_stats(pathtofile, title, time_dt, time_unit, valid_dict) 1. check if nc file already exists 2. - if so use append mode - if not create file .. py:function:: 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 verb : Boolean 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_dims : list A Python list of the NetCDF file dimensions nc_vars : list A Python list of the NetCDF file variables .. py:function:: ncdumpMeta(pathtofile) Returns dict of netcdf-file content Input: str pointing to netcdf-file Output: dict of attributes .. py:function:: 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 .. py:function:: get_varname_for_cf_stdname_in_ncfile(ncdict, stdname)