<commit_before>import pysat
import pandas as pds
import numpy as np
import numpy.ma as ma
import matplotlib.pyplot as plt

# dates for demo
ssnDays = 67
startDate = pds.datetime(2009,12,21) - pds.DateOffset(days=ssnDays)
stopDate = pds.datetime(2009,12,21) + pds.DateOffset(days=ssnDays)

# define functions to customize data for application
def geo2mag(incoord):
    """geographic coordinate to magnetic coordinate (coarse):

    Parameters
    ----------
    incoord : numpy.array of shape (2,*)
        array([[glat0,glat1,glat2,...],[glon0,glon1,glon2,...]), 
        where glat, glon are geographic latitude and longitude
        (or if you have only one point it is [[glat,glon]]).

    Warnings
    --------
    Calculation of geomagnetic coordinates is approximate.
    Coordinates are for a geomagnetic dipole, not the full field.
    Location of geomagnetic dipole set for 2010.
    
    Returns
    -------    
    array([mlat0,mlat1,...],[mlon0,mlon1,...]])
    
    Note
    ----
    Routine is generally verified as coarsely correct using 2010 values from
    http://wdc.kugi.kyoto-u.ac.jp/igrf/gggm/index.html.
    
    Examples
    --------
    mag =  geo2mag(np.array([[80.08],[287.789]]))
    print mag  
    print 'We should get [90,0]'

    mag =  geo2mag(np.array([[90],[0]]))
    print mag  
    print 'We should get something close to [80.02, 180]'


    # kyoto, japan
    mag =  geo2mag(np.array([[35.],[135.45]]))
    print mag  
    print 'We should get something close to [25.87, -154.94]'    
    
    """

    from numpy import pi, cos, sin, arctan2, sqrt, dot

    # SOME 'constants' for location of northern mag pole
    lat = 80.08#79.3
    lon = -72.211+360.#287.789 # or 71.41W
    r = 1.0

    # convert first to radians
    lon, lat = [x*pi/180 for x in lon, lat]

    glat = incoord[0] * pi / 180.0<commit_msg>Update cosmic_and_ivm_demo.py<commit_after>import pysat
import pandas as pds
import numpy as np
import numpy.ma as ma
import matplotlib.pyplot as plt

# dates for demo
ssnDays = 67
startDate = pds.datetime(2009,12,21) - pds.DateOffset(days=ssnDays)
stopDate = pds.datetime(2009,12,21) + pds.DateOffset(days=ssnDays)

# define functions to customize data for application
def geo2mag(incoord):
    """geographic coordinate to magnetic coordinate (coarse):

    Parameters
    ----------
    incoord : numpy.array of shape (2,*)
        array([[glat0,glat1,glat2,...],[glon0,glon1,glon2,...]), 
        where glat, glon are geographic latitude and longitude
        (or if you have only one point it is [[glat,glon]]).

    Warnings
    --------
    Calculation of geomagnetic coordinates is approximate.
    Coordinates are for a geomagnetic dipole, not the full field.
    Location of geomagnetic dipole set for 2010.
    
    Returns
    -------    
    array([mlat0,mlat1,...],[mlon0,mlon1,...]])
    
    Note
    ----
    Routine is generally verified as coarsely correct using 2010 values from
    http://wdc.kugi.kyoto-u.ac.jp/igrf/gggm/index.html.
    
    Copied from https://stackoverflow.com/a/7949249
    
    Examples
    --------
    mag =  geo2mag(np.array([[80.08],[287.789]]))
    print mag  
    print 'We should get [90,0]'

    mag =  geo2mag(np.array([[90],[0]]))
    print mag  
    print 'We should get something close to [80.02, 180]'


    # kyoto, japan
    mag =  geo2mag(np.array([[35.],[135.45]]))
    print mag  
    print 'We should get something close to [25.87, -154.94]'    
    
    """

    from numpy import pi, cos, sin, arctan2, sqrt, dot

    # SOME 'constants' for location of northern mag pole
    lat = 80.08#79.3
    lon = -72.211+360.#287.789 # or 71.41W
    r = 1.0

    # convert first to radians
    lon, lat = [x*pi/180 for x in lon, lat]

    glat = incoord[0] * pi / 180.0
{'fraction_non_alphanumeric': 0.13504908463783497, 'fraction_numerical': 0.06341204563544707, 'mean_word_length': 2.490740740740741, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, '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': '3597588', 'n_tokens_mistral': 1497, 'n_tokens_neox': 1275, 'n_words': 377}