<commit_before>from StringIO import StringIO
from sharppy.sharptab.profile import Profile
import urllib
import time as gmtime
import datetime
import sys
import numpy as np

## get the current utc time and format it into
## a string that can be used for the SPC url.
if sys.argv[1] != "test":
    gmtime = datetime.datetime.utcnow()
    t_str = str( gmtime )
    year = t_str[2:4]
    month = t_str[5:7]
    day = t_str[8:10]
    hour = t_str[11:13]
    if int( hour ) > 12:
        current_ob = '12'
    else:
        current_ob = '00'
        
    obstring = year + month + day + current_ob
    obstime = datetime.datetime.strptime( obstring, '%y%m%d%H')
    delta1 = datetime.timedelta( hours=12 )
    delta2 = datetime.timedelta( hours=24 )
    obs12 = obstime - delta1
    obs24 = obstime - delta2
        
    t_str = str( obs12 )
    year = t_str[2:4]
    month = t_str[5:7]
    day = t_str[8:10]
    hour = t_str[11:13]
    obstring2 = year + month + day + hour
        
    url = urllib.urlopen('http://www.spc.noaa.gov/exper/soundings/LATEST/' + str( sys.argv[1] ).upper() + '.txt')
    data = url.read()
    plot_title = data[9:26] + ' (Observed)'
    sound_data = StringIO( data )
    p, h, T, Td, wdir, wspd = np.genfromtxt( sound_data, delimiter=',', comments="%", skip_header=6, skip_footer=96, unpack=True )
    prof = Profile( pres=p, hght=h, tmpc=T, dwpc=Td, wdir=wdir, wspd=wspd )
        
    oldurl = urllib.urlopen('http://www.spc.noaa.gov/exper/soundings/' + obstring2 +'_OBS/' + str( sys.argv[1] ).upper() + '.txt')
    data = oldurl.read()
    sound_data = StringIO( data )
    p2, h2, T2, Td2, wdir2, wspd2 = np.genfromtxt( sound_data, delimiter=',', comments="%", skip_header=6, skip_footer=96, unpack=True )
    prof2 = Profile( pres=p2, hght=h2, tmpc=T2, dwpc=Td2, wdir=wdir2, wspd=wspd2 )
        
    t_str = str( obs24 )
    year = t_str[2:4]
    month = t_str[5:7]
    day = t_str[8:10]
    hour = t_str[11:13]
    obstring2 = year + month + day + hour
        
    oldurl = urllib.urlopen('http://www.spc.noaa.gov/exper/soundings/' + obstring2 +'_OBS/' + str( sys.argv[1] ).upper() + '.txt')
    data = oldurl.read()
    sound_data = StringIO( data )
    p2, h2, T2, Td2, wdir2, wspd2 = np.genfromtxt( sound_data, delimiter=',', comments="%", skip_header=6, skip_footer=96, unpack=True )
    prof3 = Profile( pres=p2, hght=h2, tmpc=T2, dwpc=Td2, wdir=wdir2, wspd=wspd2 )

else:
	sound = '''
	  966.0,    345,   21.6,   19.7,     89,  15.19,    160,      7,  297.7,  341.9,  300.4<commit_msg>removed extra profile objects<commit_after>from StringIO import StringIO
from sharppy.sharptab.profile import Profile
import urllib
import time as gmtime
import datetime
import sys
import numpy as np

## get the current utc time and format it into
## a string that can be used for the SPC url.
if sys.argv[1] != "test":
    gmtime = datetime.datetime.utcnow()
    t_str = str( gmtime )
    year = t_str[2:4]
    month = t_str[5:7]
    day = t_str[8:10]
    hour = t_str[11:13]
    if int( hour ) > 12:
        current_ob = '12'
    else:
        current_ob = '00'
        
    obstring = year + month + day + current_ob
    obstime = datetime.datetime.strptime( obstring, '%y%m%d%H')
    delta1 = datetime.timedelta( hours=12 )
    delta2 = datetime.timedelta( hours=24 )
    obs12 = obstime - delta1
    obs24 = obstime - delta2
        
    t_str = str( obs12 )
    year = t_str[2:4]
    month = t_str[5:7]
    day = t_str[8:10]
    hour = t_str[11:13]
    obstring2 = year + month + day + hour
        
    url = urllib.urlopen('http://www.spc.noaa.gov/exper/soundings/LATEST/' + str( sys.argv[1] ).upper() + '.txt')
    data = url.read()
    plot_title = data[9:26] + ' (Observed)'
    sound_data = StringIO( data )
    p, h, T, Td, wdir, wspd = np.genfromtxt( sound_data, delimiter=',', comments="%", skip_header=6, skip_footer=96, unpack=True )
    prof = Profile( pres=p, hght=h, tmpc=T, dwpc=Td, wdir=wdir, wspd=wspd )

else:
	sound = '''
	  966.0,    345,   21.6,   19.7,     89,  15.19,    160,      7,  297.7,  341.9,  300.4
{'fraction_non_alphanumeric': 0.14905149051490515, 'fraction_numerical': 0.05469327420546933, 'mean_word_length': 2.812206572769953, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '6469113', 'n_tokens_mistral': 1708, 'n_tokens_neox': 1632, 'n_words': 388}