# Path: atmos/utils.py
# def print_if(msg, condition, printfunc=None):
#     """ Print msg if condition is True"""
#     if condition:
#         if printfunc is not None:
#             printfunc(msg)
#         else:
#             print(msg)
# 
# def disptime(fmt=None):
#     now = datetime.now()
# 
#     if fmt == None:
#         fmt = '%02d/%02d/%02d %02d:%02d:%02d'
#     now = (fmt % (now.month, now.day, now.year, now.hour, now.minute,
#            now.second))
#     print(now)
#     return now
# 
# Path: atmos/constants.py



import numpy as np
import pandas as pd
import collections
import scipy.interpolate as interp
import xarray as xray
import time
import atmos.utils as utils
import atmos.xrhelper as xr
from mpl_toolkits import basemap
from xarray import Dataset
from atmos.utils import print_if, disptime
from atmos.constants import const as constants


# ======================================================================
# NETCDF FILE I/O
# ======================================================================

# ----------------------------------------------------------------------
def ncdisp(filename, verbose=True, decode_cf=False, indent=2, width=None):
    """Display the attributes of data in a netcdf file."""
    with xray.open_dataset(filename, decode_cf=decode_cf) as ds:
        if verbose:
            xr.ds_print(ds, indent, width)
        else:
            print(ds)


# ----------------------------------------------------------------------
def ncload(filename, verbose=True, unpack=True, missing_name=u'missing_value',
           offset_name=u'add_offset', scale_name=u'scale_factor',
           decode_cf=False):
    """
    Read data from netcdf file into xray dataset.

    If options are selected, unpacks from compressed form and/or replaces
    missing values with NaN.  Returns data as an xray.Dataset object.
    """
    with xray.open_dataset(filename, decode_cf=decode_cf) as ds:
        print_if('****** Reading file: ' + filename + '********', verbose)
        print_if(ds, verbose, printfunc=xr.ds_print)
        if unpack:

# Path: atmos/utils.py
# def print_if(msg, condition, printfunc=None):
#     """ Print msg if condition is True"""
#     if condition:
#         if printfunc is not None:
#             printfunc(msg)
#         else:
#             print(msg)
# 
# def disptime(fmt=None):
#     now = datetime.now()
# 
#     if fmt == None:
#         fmt = '%02d/%02d/%02d %02d:%02d:%02d'
#     now = (fmt % (now.month, now.day, now.year, now.hour, now.minute,
#            now.second))
#     print(now)
#     return now
# 
# Path: atmos/constants.py



# Path: atmos/data.py
import numpy as np
import pandas as pd
import collections
import scipy.interpolate as interp
import xarray as xray
import time
import atmos.utils as utils
import atmos.xrhelper as xr
from mpl_toolkits import basemap
from xarray import Dataset
from atmos.utils import print_if, disptime
from atmos.constants import const as constants



# ======================================================================
# NETCDF FILE I/O
# ======================================================================

# ----------------------------------------------------------------------
def ncdisp(filename, verbose=True, decode_cf=False, indent=2, width=None):
    """Display the attributes of data in a netcdf file."""
    with xray.open_dataset(filename, decode_cf=decode_cf) as ds:
        if verbose:
            xr.ds_print(ds, indent, width)
        else:
            print(ds)


# ----------------------------------------------------------------------
def ncload(filename, verbose=True, unpack=True, missing_name=u'missing_value',
           offset_name=u'add_offset', scale_name=u'scale_factor',
           decode_cf=False):
    """
    Read data from netcdf file into xray dataset.

    If options are selected, unpacks from compressed form and/or replaces
    missing values with NaN.  Returns data as an xray.Dataset object.
    """
    with xray.open_dataset(filename, decode_cf=decode_cf) as ds:
        print_if('****** Reading file: ' + filename + '********', verbose)
        print_if(ds, verbose, printfunc=xr.ds_print)
        if unpack:

            print_if('****** Unpacking data *********', verbose)