Exemple #1
0
# set get_data=True the first time through, then False for subsequent runs with the stored sounding in save_sounding.csv and metada.json

# In[4]:

get_data = True
metafile = 'metadata.json'
soundingfile = 'save_sounding.csv'
if get_data:
    values = dict(region='naconf',
                  year='2012',
                  month='7',
                  start='0100',
                  stop='3000',
                  station='72340')
    write_soundings(values, 'littlerock')
    soundings = read_soundings('littlerock')
    the_time = (2012, 7, 17, 0)
    sounding = soundings['sounding_dict'][the_time]
    sounding.to_csv(soundingfile)
    title_string = soundings['attributes']['header']
    index = title_string.find(' Observations at')
    location = title_string[:index]
    print(f'location: {location}')
    units = soundings['attributes']['units'].split(';')
    units_dict = {}
    for count, var in enumerate(sounding.columns[1:]):
        units_dict[var] = units[count]
    soundings['attributes']['location'] = location
    soundings['attributes']['units'] = units
    soundings['attributes']['time'] = the_time
    soundings['attributes']['history'] = 'written by mixing_line_calc'
Exemple #2
0
              start='0100',
              stop='1800',
              station='72261')

# %% [markdown]
# Write the soundings into a folder called soundingdir

# %%
sounding_dir = context.data_dir / 'delrio'
write_soundings(values, sounding_dir)

# %% [markdown]
# # Read the soundings back into python

# %%
soundings = read_soundings(sounding_dir)

# %% [markdown]
# # Examine the nested dictionaries inside soundings

# %%
print((f'soundings keys: {list(soundings.keys())}\n'),
      (f'soundings attributes: {list(soundings["attributes"])}\n'),
      (f'sounding_dict keys: {list(soundings["sounding_dict"].keys())}'))

# %% [markdown]
# # Get the first pandas dataframe

# %%
target_date = list(soundings['sounding_dict'].keys())[0]
print(f"retrieving {target_date}")
Exemple #3
0
              month='7',
              start='0100',
              stop='1800',
              station='72451')

# Write the soundings into a folder called soundingdir

# In[5]:

write_soundings(values, 'soundingdir')

# # Read the soundings back into python

# In[6]:

soundings = read_soundings('soundingdir')

# # Examine the nested dictionaries inside soundings

# In[7]:

print((f'soundings keys: {list(soundings.keys())}\n'),
      (f'soundings attributes: {list(soundings["attributes"])}\n'),
      (f'sounding_dict keys: {list(soundings["sounding_dict"].keys())}'))

# # Get the first sounding

# In[8]:

target_date = list(soundings['sounding_dict'].keys())[0]
the_sounding = soundings['sounding_dict'][target_date]