<commit_before>from __future__ import division
import numpy as np
import pandas as pd
import netCDF4 as nc
from datetime import datetime, timedelta
import cPickle as pickle
import sys
import os
sys.path.append('/home/wesley/github/UTide/')
from utide import ut_solv
import scipy.io as sio
from stationClass import station
from adcpClass import ADCP
from fvcomClass import FVCOM
from tidegaugeClass import Tidegauge

def mjd2num(x):

    y = x + 678942

    return y


def closest_point(points, lon, lat):

    point_list = np.array([lon,lat]).T

    print point_list
    print points
    closest_dist = ((point_list[:, 0] - points[:, 0, None])**2 +
                    (point_list[:, 1] - points[:, 1, None])**2)

    print closest_dist
    closest_point_indexes = np.argmin(closest_dist, axis=1)

    return closest_point_indexes


def datetime2matlabdn(dt):
    # ordinal = dt.toordinal()
    mdn = dt + timedelta(days=366)
    frac = (dt-datetime(dt.year, dt.month, dt.day, 0, 0, 0)).seconds / \
        (24.0 * 60.0 * 60.0)
    return mdn.toordinal() + frac



def main(fvFiles, adcpFiles, tideFiles, isStation=True, debug=False):

    #fvdebugData = FVCOM(fvdebug)
    #saveName = 'validationStruct.p'
    #Name = 'june_2013_3D_station'
    #Struct = {}

    for fvFile in fvFiles:
        print fvFile
        struct = np.array([])
        print struct
        for adcpFile in adcpFiles:
            print adcpFile
            adcpData = ADCP(adcpFile)
            lonlat = np.array([adcpData.lon[0], adcpData.lat[0]]).T

            print adcpData.mtime.shape
            print adcpData.ua.shape
            print adcpData.va.shape
            print adcpData.surf.shape

            adcpVelCoef = ut_solv(adcpData.mtime, adcpData.ua,
                            adcpData.va, adcpData.lat[0],
                            cnstit='auto', rmin=0.95, notrend=True,
                            method='ols', nodiagn=True, linci=True, coef_int=True)
<commit_msg>fixed repeating struct<commit_after>from __future__ import division
import numpy as np
import pandas as pd
import netCDF4 as nc
from datetime import datetime, timedelta
import cPickle as pickle
import sys
import os
sys.path.append('/home/wesley/github/UTide/')
from utide import ut_solv
import scipy.io as sio
from stationClass import station
from adcpClass import ADCP
from fvcomClass import FVCOM
from tidegaugeClass import Tidegauge

def mjd2num(x):

    y = x + 678942

    return y


def closest_point(points, lon, lat):

    point_list = np.array([lon,lat]).T

    print point_list
    print points
    closest_dist = ((point_list[:, 0] - points[:, 0, None])**2 +
                    (point_list[:, 1] - points[:, 1, None])**2)

    print closest_dist
    closest_point_indexes = np.argmin(closest_dist, axis=1)

    return closest_point_indexes


def datetime2matlabdn(dt):
    # ordinal = dt.toordinal()
    mdn = dt + timedelta(days=366)
    frac = (dt-datetime(dt.year, dt.month, dt.day, 0, 0, 0)).seconds / \
        (24.0 * 60.0 * 60.0)
    return mdn.toordinal() + frac



def main(fvFiles, adcpFiles, tideFiles, isStation=True, debug=False):

    #fvdebugData = FVCOM(fvdebug)
    #saveName = 'validationStruct.p'
    #Name = 'june_2013_3D_station'
    #Struct = {}

    for fvFile in fvFiles:
        print fvFile
        struct = np.array([])
        for adcpFile in adcpFiles:
            print adcpFile
            adcpData = ADCP(adcpFile)
            lonlat = np.array([adcpData.lon[0], adcpData.lat[0]]).T

            print adcpData.mtime.shape
            print adcpData.ua.shape
            print adcpData.va.shape
            print adcpData.surf.shape

            adcpVelCoef = ut_solv(adcpData.mtime, adcpData.ua,
                            adcpData.va, adcpData.lat[0],
                            cnstit='auto', rmin=0.95, notrend=True,
                            method='ols', nodiagn=True, linci=True, coef_int=True)

{'fraction_non_alphanumeric': 0.10378323108384459, 'fraction_numerical': 0.02147239263803681, 'mean_word_length': 2.4906333630686888, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '5872963', 'n_tokens_mistral': 1402, 'n_tokens_neox': 1314, 'n_words': 326}