<jupyter_start><jupyter_text>SSMI Decoder NRTBootstrap<jupyter_code>import numpy as np
import pandas as pd
def decode_datafile(filename,datasource='NRT'):
    icefile = open(filename, 'rb')

    if datasource is 'NRT':
       #remove the header
       icefile.seek(300)
       ice = np.fromfile(icefile,dtype=np.uint8)
       ice[ice >= 253] = 0
       ice = ice/2.5
    elif datasource is 'Bootstrap':
       #no header
       ice = np.fromfile(icefile,dtype=np.uint16)
       ice = ice/10.
       ice[ice == 110] = 0 #110 is land
       ice[ice == 120] = 100 #120 is polar hole
    else:
       ice=np.nan

    return ice;


def get_date(filename):
    icefile = open(filename, 'rb')
    header = icefile.read(300)
    #the date is located btw the following bytes
    date = date=header[219:229].decode() #gets date from header
    date = dt.datetime.strptime(date,"%m/%d/%Y")
    return date;

def decode_latlon(filename):
    latlon_file = open(filename, 'rb')
    output = np.fromfile(latlon_file,dtype='<i4')
    output = output/100000.0
    return output;
fp = '/Users/bell/in_and_outbox/data_sets/nrt_nasatime_seaice/nt_20190303_f18_nrt_n.bin'
ice = decode_datafile(fp,datasource='NRT')
lats_fp='data/psn25lats_v3.dat'
lats = decode_latlon(lats_fp)
lons_fp='data/psn25lons_v3.dat'
lons = decode_latlon(lons_fp)
np.shape(ice)
np.shape(lats)
data={'latitude':decode_latlon(lats_fp), 'longitude':decode_latlon(lons_fp),
      'ice_conc':decode_datafile(fp,'NRT')}
df=pd.DataFrame(data)
df.describe()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13233376792698825, 'fraction_numerical': 0.04106910039113429, 'mean_word_length': 3.888535031847134, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '471934', 'license': 'MIT', 'n_tokens_mistral': 632, 'n_tokens_neox': 585, 'n_words': 110, 'path': 'IceAnalysis/SSMI_Decoder.ipynb', 'repo_name': 'shaunwbell/ipythonnb', 'size': '1534'}