Esempio n. 1
0
    print(pTB.range[ir_range[0]], pTB.range[ir_range[1]])
    ranges = pTB.range[ir_range[0]:ir_range[1]]
    print("ranges ", ranges)

    meta = {}
    for a in pTB.f.ncattrs():
        meta[a] = pTB.f.getncattr(a)
    meta['json_timeinterval'] = it_range
    meta['json_rangeinterval'] = ir_range

    return {'ts': format_for_json(timestamps), 'rg': format_for_json(ranges), 
            'var': var.tolist(), 'dimlabel': ['time', 'range', 'tree'],
            'paraminfo': meta}


pTB = peakTree.peakTreeBuffer()
#pTB = peakTree.peakTreeBuffer(system="Polarstern")
#pTB.load_peakTree_file('output/20170629_0830_Pol_peakTree.nc4')
pTB.load_peakTree_file(args.file)


time_interval = args.time_interval.split('-')
if time_interval[1] == "max":
    time_interval[1] = pTB.timestamps.shape[0][-1]
time_interval = list(map(int, time_interval))

range_interval = args.range_interval.split('-')
if range_interval[1] == "max":
    range_interval[1] = pTB.range[0][-1]
range_interval = list(map(int, range_interval))
Esempio n. 2
0
                    help='plot nodes up to this no (including)')
parser.add_argument('--range-interval',
                    type=str,
                    default='min,10000',
                    help='range to plot. e.g. min,7000, min,max, 500,max')
parser.add_argument('--time-interval',
                    type=str,
                    default='',
                    help='range to plot. e.g. min,7000, min,max, 500,max')
parser.add_argument('--plotsubfolder',
                    default='',
                    help='path of the plot subfolder')
parser.add_argument('--system', default='', help='system identifier')
args = parser.parse_args()

pTB = peakTree.peakTreeBuffer(system=args.system)
pTB.load_peakTree_file(args.file)

if args.plotsubfolder == '':
    savepath = 'plots/'
else:
    savepath = 'plots/{}/'.format(args.plotsubfolder)
if not os.path.isdir(savepath):
    os.makedirs(savepath)

dt_list = [h.ts_to_dt(ts) for ts in pTB.timestamps]
print("temp_gradient ",
      np.percentile(np.gradient(pTB.timestamps), [10, 25, 50, 75, 90]))
hrange = pTB.range
no_nodes = pTB.f.variables['no_nodes'][:]
Esempio n. 3
0
#! /usr/bin/env python3
# coding=utf-8

import datetime
#import matplotlib
#matplotlib.use('Agg')
#import numpy as np
#import matplotlib.pyplot as plt

#import sys, os
import peakTree
import peakTree.helpers as h

pTB = peakTree.peakTreeBuffer()
pTB = peakTree.peakTreeBuffer(system='kazr_baecc_peako')
#pTB.load_peako_file('data/kazr20140221220005_22.54_22.77_spectra_edges.nc')
pTB.load_peako_file('data/kazr20140202160004_16.001_16.99_spectra_edges.nc')
#dt = datetime.datetime(2014,2,21,22,40,0,0)
#pTB.get_tree_at(h.dt_to_ts(dt), 2900)
#pTB.assemble_time_height('output/')

pTB = peakTree.peakTreeBuffer(system='kazr_baecc')
#pTB.load_kazr_file('data/20140221_2200_kazr_preprocessed.nc4')
pTB.load_kazr_file('data/20140202_1600_kazr_preprocessed.nc4')
#dt = datetime.datetime(2014,2,21,22,40,0,0)
#pTB.get_tree_at(h.dt_to_ts(dt), 2900, temporal_average=4)
pTB.assemble_time_height('output/')
Esempio n. 4
0
#! /usr/bin/env python3
# coding=utf-8

import datetime
#import matplotlib
#matplotlib.use('Agg')
#import numpy as np
#import matplotlib.pyplot as plt

#import sys, os
import peakTree
import peakTree.helpers as h

import logging
log = logging.getLogger('peakTree')
log.setLevel(logging.INFO)
log.addHandler(logging.StreamHandler())

pTB = peakTree.peakTreeBuffer(system='joyrad_nya')
#pTB.load_joyrad_file('data/joyrad94_nya_20191108000001_P01_ZEN.nc', load_to_ram=True)
#TB.load_joyrad_file('data/joyrad94_nya_20191108120000_P01_ZEN.nc', load_to_ram=True)

## older files
#pTB.load_joyrad_file('data/joyrad94_nya_20170602100002_P05_ZEN.nc', load_to_ram=True)
##pTB.load_joyrad_file('data/joyrad94_nya_20170602110001_P05_ZEN.nc', load_to_ram=True)
#pTB.assemble_time_height('output/')
#exit()

pTB.load('data/joyrad94_20200401180001_P01_ZEN.lv0', load_to_ram=True)
pTB.assemble_time_height('output/')
Esempio n. 5
0
#     pTB = peakTree.peakTreeBuffer(config_file='instrument_config.toml', system='Lacros_Pun')
#     pTB.load_spec_file(f, load_to_ram=True)
#     pTB.assemble_time_height('output/')


#pTB = peakTree.peakTreeBuffer(system='Polarstern')
#pTB.load_spec_file('data/D20170605_T0030_0045_Pol_zspc2nc_v1_02_standard.nc4')
#pTB.load_spec_file('data/D20170629_T0830_0945_Pol_zspc2nc_v1_02_standard.nc4')
#pTB.assemble_time_height('output/')
#pTB.load_spec_file('data/D20170629_T0800_0930_Pol_zspc2nc_v1_02_standard.nc4')
#pTB.assemble_time_height('output/')
#pTB.load_spec_file('data/D20170629_T0830_0945_Pol_zspc2nc_v1_02_standard.nc4')
#pTB.assemble_time_height('output/')

#pTB = peakTree.peakTreeBuffer(config_file='instrument_config.toml', system='Lacros_Pun')
pTB = peakTree.peakTreeBuffer(system='Lacros_Pun')
#pTB.load_spec_file('data/D20190317_T0600_0700_Pun_zspc2nc_v1_02_standard.nc4', load_to_ram=True)
pTB.load_spec_file('data/D20190911_T0300_0400_Pun_zspc2nc_v2.0_standard.nc4', load_to_ram=True)
pTB.assemble_time_height('output/')
exit()


path = 'data/'
files = os.listdir(path)
valid_time = ['20190711', '20190713']
print('total no files in ', path, ' : ', len(files))
files = [path+f for f in files if f[1:9] >= valid_time[0] and f[1:9] <= valid_time[1]]
files = sorted(files)
print('files selected', len(files))

for f in files:
Esempio n. 6
0
def test_dummy():
    ts = 1489262404
    rg = 3300
    pTB = pT.peakTreeBuffer()
    pTB.load_spec_file('data/D20170311_T2000_2100_Lim_zspc2nc_v1_02_standard.nc4')
    tree_spec, _ = pTB.get_tree_at(ts, rg)
Esempio n. 7
0
#date = datetime.datetime(2019, 2, 3)

path = 'data/{}/{}/'.format(args.instrument, date.strftime('%Y%m%d'))

files = os.listdir(path)
files = [f for f in files if ('.nc' in f or '.cdf' in f)]
print(files)
#files = [f for f in files if int(re.findall("T(\d*)", f)[0]) > 1300]

outpath = 'output/{}/{}/'.format(args.instrument, date.strftime('%Y%m%d'))
if not os.path.isdir(outpath):
    os.mkdir(outpath)
    print('created output path ', outpath)

pTB = peakTree.peakTreeBuffer(config_file='instrument_config.toml', system=args.config)

# filter for patrics test
#files = [f for f in files if "ldrcorr" in f]
if args.config == 'Lacros_Pun':
    #files = [f for f in files if "T1300_" in f]
    files = [f for f in files if "v2.0" in f]

for f in sorted(files)[:]:
    print('now doing ', f)
    pTB.load(path+f, load_to_ram=True)
    pTB.assemble_time_height(outpath)


exit()
Esempio n. 8
0
import datetime 
#import matplotlib 
#matplotlib.use('Agg') 
#import numpy as np 
#import matplotlib.pyplot as plt 
 
#import sys, os 
import peakTree 
import peakTree.helpers as h 
 
import logging
log = logging.getLogger('peakTree')
log.setLevel(logging.INFO)
log.addHandler(logging.StreamHandler())
 
pTB = peakTree.peakTreeBuffer(system='kazr_mosaic') 
#pTB.load_newkazr_file('data/kazr_mosaic_ge/moskazrcfrspcgecopolM1.a1.20191021.020003.nc', load_to_ram=True) 
#pTB.assemble_time_height('output/kazr_mosaic_ge/') 

pTB.load_newkazr_file('data/moskazrcfrspcgecopolM1.a1.20200407.000003.nc', load_to_ram=True) 
pTB.assemble_time_height('output/') 




#pTB = peakTree.peakTreeBuffer(system='kazr_baecc') 
#pTB.load_kazr_file('data/tmpkazrspeccmaskgecopolM1.a0.20140202.160004.cdf', load_to_ram=True) 
#pTB.load_kazr_file('data/tmpkazrspeccmaskgecopolM1.a0.20140221.220005.cdf', load_to_ram=True)
#dt = datetime.datetime(2014,2,21,22,40,0,0) 
#pTB.get_tree_at(h.dt_to_ts(dt), 2900, temporal_average=4) 
#pTB.assemble_time_height('output/') 
Esempio n. 9
0
log.addHandler(logging.StreamHandler())

#pTB = peakTree.peakTreeBuffer(system='limrad_peako')

# IDEA: for now run with temporal_average = False
# t_avg: number of neighbors in time dimension (both sides)
# h_avg: number of neighbors in range dimension (both sides)
# span: loess span
# width_thres: minimum peak width [m/s]
# prom_thres: minimum peak prominence in dBZ

#pTB.load_limrad_spec('data/20181216-1210-1215_LIMRAD94_spectra.nc', load_to_ram=True)
#pTB.load_limrad_spec('data/20181216-1510-1515_LIMRAD94_spectra.nc', load_to_ram=True)
#pTB.load_limrad_spec('data/20190223-1440-1500_LIMRAD94_spectra.nc', load_to_ram=True)
#pTB.load('data/210319_140002_P05_ZEN.LV0_rpgpy.NC', load_to_ram=True)
#pTB.load('data/rpgpy_limrad_new/190911_030001_P05_ZEN.LV0.NC', load_to_ram=True)
#pTB.load('data/190911_030001_P05_ZEN.LV0.rpgpy.NC', load_to_ram=True)

# with the binary reader
pTB = peakTree.peakTreeBuffer(system='limrad_punta')
pTB.load('data/190911_030001_P05_ZEN.LV0', load_to_ram=True)
pTB.assemble_time_height('output/', fname_system=True)

pTB = peakTree.peakTreeBuffer(system='limrad_punta')
pTB.load('data/190313_080000_P05_ZEN.LV0', load_to_ram=True)
pTB.assemble_time_height('output/', fname_system=True)

pTB = peakTree.peakTreeBuffer(system='limrad_peako')
pTB.load('data/210319_140002_P05_ZEN.LV0', load_to_ram=True)
pTB.assemble_time_height('output/', fname_system=True)