<commit_before># -*- coding: utf-8 -*-
# Copyright (C) 2017 AGB
# Full license can be found in LICENSE.txt
# ---------------------------------------------------------------------------
"""Perform OCB gridding for appropriate instrument data loaded in pysat.

Notes
-----
pysat is available at: http://github.com/pysat/pysat or pypi

"""

import datetime as dt
import numpy as np
import warnings

try:
    import pysat
except ImportError as ierr:
    err = ''.join(['unable to load the pysat modules; pysat is available at:',
                   '\nhttps://github.com/pysat/pysat'])
    raise ImportError("{:s}\n{:}".format(err, ierr))

import ocbpy
import ocbpy.ocb_scaling as ocbscal


def add_ocb_to_data(pysat_inst, mlat_name='', mlt_name='', evar_names=None,
                    curl_evar_names=None, vector_names=None, hemisphere=0,
                    ocb=None, ocbfile='default', instrument='', max_sdiff=60,
                    min_merit=None, max_merit=None, **kwargs):
    """Covert the location of pysat data into OCB coordinates.

    Parameters
    ----------
    pysat_inst : pysat.Instrument
        pysat.Instrument class object containing magnetic coordinates
    mlat_name : str
        Instrument data key or column for magnetic latitudes (default='')
    mlt_name : str
        Instrument data key or column formagnetic longitudes (default='')
    evar_names : list or NoneType
        List of Instrument data keys or columns pointing to measurements that
        are proportional to the electric field (E); e.g. ion drift
        (default=None)
    curl_evar_names : list or NoneType
        List of Instrument data keys or columns pointing to measurements that
        are proportional to the curl of E; e.g. ion vorticity (default=None)
    vector_names : dict or NoneType
        Dict of Instrument data keys or columns pointing to measurements that
        are vectors that are proportional to either E or the curl of E. The
        key should correspond to one of the values in the evar_names or
        curl_evar_names list.  If this is not done, a scaling function must be
        provided.  The value corresponding to each key must be a dict that
        indicates the names holding data needed to initialise the
        ocbpy.ocb_scaling.VectorData object (default=None)<commit_msg>DOC: fixed docstring<commit_after># -*- coding: utf-8 -*-
# Copyright (C) 2017 AGB
# Full license can be found in LICENSE.txt
# ---------------------------------------------------------------------------
"""Perform OCB gridding for appropriate instrument data loaded in pysat.

Notes
-----
pysat is available at: http://github.com/pysat/pysat or pypi

"""

import datetime as dt
import numpy as np
import warnings

try:
    import pysat
except ImportError as ierr:
    err = ''.join(['unable to load the pysat modules; pysat is available at:',
                   '\nhttps://github.com/pysat/pysat'])
    raise ImportError("{:s}\n{:}".format(err, ierr))

import ocbpy
import ocbpy.ocb_scaling as ocbscal


def add_ocb_to_data(pysat_inst, mlat_name='', mlt_name='', evar_names=None,
                    curl_evar_names=None, vector_names=None, hemisphere=0,
                    ocb=None, ocbfile='default', instrument='', max_sdiff=60,
                    min_merit=None, max_merit=None, **kwargs):
    """Covert the location of pysat data into OCB coordinates.

    Parameters
    ----------
    pysat_inst : pysat.Instrument
        pysat.Instrument class object containing magnetic coordinates
    mlat_name : str
        Instrument data key or column for magnetic latitudes (default='')
    mlt_name : str
        Instrument data key or column for magnetic local times (default='')
    evar_names : list or NoneType
        List of Instrument data keys or columns pointing to measurements that
        are proportional to the electric field (E); e.g. ion drift
        (default=None)
    curl_evar_names : list or NoneType
        List of Instrument data keys or columns pointing to measurements that
        are proportional to the curl of E; e.g. ion vorticity (default=None)
    vector_names : dict or NoneType
        Dict of Instrument data keys or columns pointing to measurements that
        are vectors that are proportional to either E or the curl of E. The
        key should correspond to one of the values in the evar_names or
        curl_evar_names list.  If this is not done, a scaling function must be
        provided.  The value corresponding to each key must be a dict that
        indicates the names holding data needed to initialise the
        ocbpy.ocb_scaling.VectorData object (default=None)
{'fraction_non_alphanumeric': 0.10602461671345281, 'fraction_numerical': 0.0034549773267112936, 'mean_word_length': 2.55487336914812, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2123690', 'n_tokens_mistral': 1311, 'n_tokens_neox': 1259, 'n_words': 509}