The requested changes are too big and content was truncated. Show full diff
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
@@ -1,122 +1,122 | |||
|
1 | 1 | # Ing. AVP |
|
2 | 2 | # 04/01/2022 |
|
3 | 3 | # ARCHIVO DE LECTURA |
|
4 | 4 | #---- DATA RHI --- 23 DE NOVIEMBRE DEL 2021 --- 23/11/2021--- |
|
5 | 5 | #---- PEDESTAL ---------------------------------------------- |
|
6 | 6 | #------- HORA 143826 /DATA_RM/TEST_PEDESTAL/P20211123-143826 14:38-15:10 |
|
7 | 7 | #---- RADAR ---------------------------------------------- |
|
8 | 8 | #------- 14:26-15:00 |
|
9 | 9 | #------- /DATA_RM/DRONE/2MHZ_5V_ELEVACION/ |
|
10 | 10 | #------- /DATA_RM/DRONE/2MHZ_5V_ELEVACION/ch0/2021-11-23T19-00-00 |
|
11 | 11 | |
|
12 | 12 | import os, sys |
|
13 | 13 | import datetime |
|
14 | 14 | import time |
|
15 | 15 | import numpy |
|
16 | 16 | from ext_met import getfirstFilefromPath,getDatavaluefromDirFilename |
|
17 | 17 | from schainpy.controller import Project |
|
18 | 18 | #----------------------------------------------------------------------------------------- |
|
19 | 19 | print("[SETUP]-RADAR METEOROLOGICO-") |
|
20 | 20 | path_ped = "/DATA_RM/TEST_PEDESTAL/P20211123-143826" |
|
21 | 21 | print("PATH PEDESTAL :",path_ped) |
|
22 | 22 | path_adq = "/DATA_RM/DRONE/2MHZ_5V_ELEVACION/" |
|
23 | 23 | print("PATH DATA :",path_adq) |
|
24 | 24 | figpath_pp_rti = "/home/soporte/Pictures/TEST_PP_RHI" |
|
25 | 25 | print("PATH PP RTI :",figpath_pp_rti) |
|
26 | 26 | figpath_pp_rhi = "/home/soporte/Pictures/TEST_PP_RHI" |
|
27 | 27 | print("PATH PP RHI :",figpath_pp_rhi) |
|
28 | 28 | path_pp_save_int = "/DATA_RM/TEST_SAVE_PP_INT_RHI" |
|
29 | 29 | print("PATH SAVE PP INT :",path_pp_save_int) |
|
30 | 30 | print(" ") |
|
31 | 31 | #------------------------------------------------------------------------------------------- |
|
32 | 32 | print("SELECCIONAR MODO: PPI (0) O RHI (1)") |
|
33 | 33 | mode_wr = 1 |
|
34 | 34 | if mode_wr==0: |
|
35 | 35 | print("[ ON ] MODE PPI") |
|
36 | 36 | list_ped = getfirstFilefromPath(path=path_ped,meta="PE",ext=".hdf5") |
|
37 | 37 | ff_pedestal = list_ped[2] |
|
38 | 38 | azi_vel = getDatavaluefromDirFilename(path=path_ped,file=ff_pedestal,value="azi_vel") |
|
39 | 39 | V = round(azi_vel[0]) |
|
40 | 40 | print("VELOCIDAD AZI :", int(numpy.mean(azi_vel)),"°/seg") |
|
41 | 41 | else: |
|
42 | 42 | print("[ ON ] MODE RHI") |
|
43 | 43 | list_ped = getfirstFilefromPath(path=path_ped,meta="PE",ext=".hdf5") |
|
44 | 44 | ff_pedestal = list_ped[2] |
|
45 | 45 | ele_vel = getDatavaluefromDirFilename(path=path_ped,file=ff_pedestal,value="ele_vel") |
|
46 | 46 | V = round(ele_vel[0]) |
|
47 | 47 | V = 10.0 |
|
48 | 48 | print("VELOCIDAD ELE :", int(numpy.mean(ele_vel)),"°/seg") |
|
49 | 49 | print(" ") |
|
50 | 50 | #--------------------------------------------------------------------------------------- |
|
51 | 51 | print("SELECCIONAR MODO: PULSE PAIR (0) O FREQUENCY (1)") |
|
52 | 52 | mode_proc = 0 |
|
53 | 53 | if mode_proc==0: |
|
54 | 54 | print("[ ON ] MODE PULSEPAIR") |
|
55 | 55 | else: |
|
56 | 56 | print("[ ON ] MODE FREQUENCY") |
|
57 | 57 | ipp = 60.0 |
|
58 | 58 | print("IPP(Km.) : %1.2f"%ipp) |
|
59 | 59 | ipp_sec = (ipp*1.0e3/150.0)*1.0e-6 |
|
60 | 60 | print("IPP(useg.) : %1.2f"%(ipp_sec*(1.0e6))) |
|
61 | 61 | VEL=V |
|
62 | 62 | n= int(1/(VEL*ipp_sec)) |
|
63 | 63 | print("N° Profiles : ", n) |
|
64 | 64 | #-------------------------------------------- |
|
65 | 65 | plot_rti = 0 |
|
66 | 66 | plot_rhi = 1 |
|
67 | 67 | integration = 1 |
|
68 | 68 | save = 0 |
|
69 | 69 | #---------------------------RANGO DE PLOTEO---------------------------------- |
|
70 | 70 | dBmin = '1' |
|
71 | 71 | dBmax = '85' |
|
72 | 72 | xmin = '17' |
|
73 | 73 | xmax = '17.25' |
|
74 | 74 | ymin = '0' |
|
75 | 75 | ymax = '600' |
|
76 | 76 | #---------------------------------------------------------------------------- |
|
77 | 77 | time.sleep(3) |
|
78 | 78 | #---------------------SIGNAL CHAIN ------------------------------------ |
|
79 | 79 | desc = "USRP_WEATHER_RADAR" |
|
80 | 80 | filename = "USRP_processing.xml" |
|
81 | 81 | controllerObj = Project() |
|
82 | 82 | controllerObj.setup(id = '191', name='Test_USRP', description=desc) |
|
83 | 83 | #---------------------UNIDAD DE LECTURA-------------------------------- |
|
84 | 84 | readUnitConfObj = controllerObj.addReadUnit(datatype='DigitalRFReader', |
|
85 | 85 | path=path_adq, |
|
86 |
startDate="2021/11/ |
|
|
86 | startDate="2021/11/23",#today, | |
|
87 | 87 | endDate="2021/12/30",#today, |
|
88 |
startTime='1 |
|
|
88 | startTime='14:38:23', | |
|
89 | 89 | endTime='23:59:59', |
|
90 | 90 | delay=0, |
|
91 | 91 | #set=0, |
|
92 | 92 | online=0, |
|
93 | 93 | walk=1, |
|
94 | 94 | ippKm=ipp) |
|
95 | 95 | |
|
96 | 96 | procUnitConfObjA = controllerObj.addProcUnit(datatype='VoltageProc',inputId=readUnitConfObj.getId()) |
|
97 | 97 | |
|
98 | 98 | opObj11 = procUnitConfObjA.addOperation(name='selectHeights') |
|
99 | 99 | opObj11.addParameter(name='minIndex', value='1', format='int') |
|
100 | 100 | # opObj11.addParameter(name='maxIndex', value='10000', format='int') |
|
101 | 101 | opObj11.addParameter(name='maxIndex', value='400', format='int') |
|
102 | 102 | |
|
103 | 103 | if mode_proc==0: |
|
104 | 104 | opObj11 = procUnitConfObjA.addOperation(name='PulsePair', optype='other') |
|
105 | 105 | opObj11.addParameter(name='n', value=int(n), format='int') |
|
106 | 106 | procUnitConfObjB= controllerObj.addProcUnit(datatype='ParametersProc',inputId=procUnitConfObjA.getId()) |
|
107 | 107 | |
|
108 | 108 | if integration==1: |
|
109 | 109 | opObj11 = procUnitConfObjB.addOperation(name='PedestalInformation') |
|
110 | 110 | opObj11.addParameter(name='path_ped', value=path_ped) |
|
111 | 111 | opObj11.addParameter(name='t_Interval_p', value='0.01', format='float') |
|
112 | 112 | |
|
113 | 113 | if plot_rhi==1: |
|
114 | 114 | opObj11 = procUnitConfObjB.addOperation(name='Block360') |
|
115 | 115 | opObj11.addParameter(name='n', value='10', format='int') |
|
116 | 116 | opObj11.addParameter(name='mode', value=mode_proc, format='int') |
|
117 | 117 | # este bloque funciona bien con divisores de 360 no olvidar 0 10 20 30 40 60 90 120 180 |
|
118 | 118 | opObj11= procUnitConfObjB.addOperation(name='WeatherRHIPlot',optype='other') |
|
119 | 119 | opObj11.addParameter(name='save', value=figpath_pp_rhi) |
|
120 | 120 | opObj11.addParameter(name='save_period', value=1) |
|
121 | 121 | |
|
122 | 122 | controllerObj.start() |
@@ -1,122 +1,123 | |||
|
1 | 1 | # Ing-AlexanderValdez |
|
2 | 2 | # Monitoreo de Pedestal |
|
3 | 3 | |
|
4 | 4 | ############## IMPORTA LIBRERIAS ################### |
|
5 | 5 | import os,numpy,h5py |
|
6 | 6 | import sys,time |
|
7 | 7 | import matplotlib.pyplot as plt |
|
8 | 8 | #################################################### |
|
9 | 9 | ################################################################# |
|
10 | 10 | # LA FECHA 21-10-20 CORRESPONDE A LAS PRUEBAS DEL DIA MIERCOLES |
|
11 | 11 | # 1:15:51 pm hasta 3:49:32 pm |
|
12 | 12 | ################################################################# |
|
13 | 13 | |
|
14 | 14 | #path_ped = '/DATA_RM/TEST_PEDESTAL/P20211012-082745' |
|
15 | 15 | path_ped = '/DATA_RM/TEST_PEDESTAL/P20211020-131248' |
|
16 | 16 | path_ped = '/DATA_RM/TEST_PEDESTAL/P20211110-171003' |
|
17 | 17 | path_ped = '/DATA_RM/TEST_PEDESTAL/P20211111-173856' |
|
18 | path_ped = '/DATA_RM/TEST_PEDESTAL/P20211123-143826' | |
|
18 | 19 | #path_ped = '/DATA_RM/TEST_PEDESTAL/P20211111-173409' |
|
19 | 20 | # Metodo para verificar numero |
|
20 | 21 | def isNumber(str): |
|
21 | 22 | try: |
|
22 | 23 | float(str) |
|
23 | 24 | return True |
|
24 | 25 | except: |
|
25 | 26 | return False |
|
26 | 27 | # Metodo para extraer el arreglo |
|
27 | 28 | def getDatavaluefromDirFilename(path,file,value): |
|
28 | 29 | dir_file= path+"/"+file |
|
29 | 30 | fp = h5py.File(dir_file,'r') |
|
30 | 31 | array = fp['Data'].get(value)[()] |
|
31 | 32 | fp.close() |
|
32 | 33 | return array |
|
33 | 34 | |
|
34 | 35 | # LISTA COMPLETA DE ARCHIVOS HDF5 Pedestal |
|
35 | 36 | LIST= sorted(os.listdir(path_ped)) |
|
36 | 37 | m=len(LIST) |
|
37 | 38 | print("TOTAL DE ARCHIVOS DE PEDESTAL:",m) |
|
38 | 39 | # Contadores temporales |
|
39 | 40 | k= 0 |
|
40 | 41 | l= 0 |
|
41 | 42 | t= 0 |
|
42 | 43 | # Marca de tiempo temporal |
|
43 | 44 | time_ = numpy.zeros([m]) |
|
44 | 45 | # creacion de |
|
45 | 46 | for i in range(m): |
|
46 | 47 | print("order:",i) |
|
47 | 48 | tmp_azi_pos = getDatavaluefromDirFilename(path=path_ped,file=LIST[i],value="azi_pos") |
|
48 | 49 | tmp_ele_pos = getDatavaluefromDirFilename(path=path_ped,file=LIST[i],value="ele_pos") |
|
49 | 50 | tmp_azi_vel = getDatavaluefromDirFilename(path=path_ped,file=LIST[i],value="azi_vel") |
|
50 | 51 | tmp_ele_vel = getDatavaluefromDirFilename(path=path_ped,file=LIST[i],value="azi_vel")# nuevo :D |
|
51 | 52 | |
|
52 | 53 | time_[i] = getDatavaluefromDirFilename(path=path_ped,file=LIST[i],value="utc") |
|
53 | 54 | |
|
54 | 55 | k=k +tmp_azi_pos.shape[0] |
|
55 | 56 | l=l +tmp_ele_pos.shape[0] |
|
56 | 57 | t=t +tmp_azi_vel.shape[0] |
|
57 | 58 | |
|
58 | 59 | print("TOTAL DE MUESTRAS, ARCHIVOS X100:",k) |
|
59 | 60 | time.sleep(5) |
|
60 | 61 | ######CREACION DE ARREGLOS CANTIDAD DE VALORES POR MUESTRA################# |
|
61 | 62 | azi_pos = numpy.zeros([k]) |
|
62 | 63 | ele_pos = numpy.zeros([l]) |
|
63 | 64 | time_azi_pos= numpy.zeros([k]) |
|
64 | 65 | # Contadores temporales |
|
65 | 66 | p=0 |
|
66 | 67 | r=0 |
|
67 | 68 | z=0 |
|
68 | 69 | # VARIABLES TMP para almacenar azimuth, elevacion y tiempo |
|
69 | 70 | |
|
70 | 71 | #for filename in sorted(os.listdir(path_ped)): |
|
71 | 72 | # CONDICION POR LEER EN TIEMPO REAL NO OFFLINE |
|
72 | 73 | |
|
73 | 74 | for filename in LIST: |
|
74 | 75 | tmp_azi_pos = getDatavaluefromDirFilename(path=path_ped,file=filename,value="azi_pos") |
|
75 | 76 | tmp_ele_pos = getDatavaluefromDirFilename(path=path_ped,file=filename,value="ele_pos") |
|
76 | 77 | # CONDICION POR LEER EN TIEMPO REAL NO OFFLINE |
|
77 | 78 | |
|
78 | 79 | if z==(m-1): |
|
79 | 80 | tmp_azi_time=numpy.arange(time_[z],time_[z]+1,1/(tmp_azi_pos.shape[0])) |
|
80 | 81 | else: |
|
81 | 82 | tmp_azi_time=numpy.arange(time_[z],time_[z+1],(time_[z+1]-time_[z])/(tmp_azi_pos.shape[0])) |
|
82 | 83 | |
|
83 | 84 | print(filename,time_[z]) |
|
84 | 85 | print(z,tmp_azi_pos.shape[0]) |
|
85 | 86 | |
|
86 | 87 | i=0 |
|
87 | 88 | for i in range(tmp_azi_pos.shape[0]): |
|
88 | 89 | index=p+i |
|
89 | 90 | azi_pos[index]=tmp_azi_pos[i] |
|
90 | 91 | time_azi_pos[index]=tmp_azi_time[i] |
|
91 | 92 | p=p+tmp_azi_pos.shape[0] |
|
92 | 93 | i=0 |
|
93 | 94 | for i in range(tmp_ele_pos.shape[0]): |
|
94 | 95 | index=r+i |
|
95 | 96 | ele_pos[index]=tmp_ele_pos[i] |
|
96 | 97 | r=r+tmp_ele_pos.shape[0] |
|
97 | 98 | |
|
98 | 99 | |
|
99 | 100 | z+=1 |
|
100 | 101 | |
|
101 | 102 | |
|
102 | 103 | ######## GRAFIQUEMOS Y VEAMOS LOS DATOS DEL Pedestal |
|
103 | 104 | fig, ax = plt.subplots(figsize=(16,8)) |
|
104 | 105 | print(time_azi_pos.shape) |
|
105 | 106 | print(azi_pos.shape) |
|
106 | 107 | t=numpy.arange(time_azi_pos.shape[0])*0.01/(60.0) |
|
107 | 108 | plt.plot(t,azi_pos,label='AZIMUTH_POS',color='blue') |
|
108 | 109 | |
|
109 | 110 | # AQUI ESTOY ADICIONANDO LA POSICION EN elevaciont=numpy.arange(len(ele_pos))*0.01/60.0 |
|
110 | 111 | t=numpy.arange(len(ele_pos))*0.01/60.0 |
|
111 | 112 | plt.plot(t,ele_pos,label='ELEVATION_POS',color='red')#*10 |
|
112 | 113 | |
|
113 |
|
|
|
114 |
ax.set_ylim(-5, |
|
|
114 | ax.set_xlim(0, 4) | |
|
115 | ax.set_ylim(-5, 50) | |
|
115 | 116 | plt.ylabel("Azimuth Position") |
|
116 | 117 | plt.xlabel("Muestra") |
|
117 | 118 | plt.title('Azimuth Position vs Muestra ', fontsize=20) |
|
118 | 119 | axes = plt.gca() |
|
119 | 120 | axes.yaxis.grid() |
|
120 | 121 | plt.xticks(fontsize=16) |
|
121 | 122 | plt.yticks(fontsize=16) |
|
122 | 123 | plt.show() |
@@ -1,57 +1,58 | |||
|
1 | 1 | import numpy as np |
|
2 | 2 | import matplotlib.pyplot as plt |
|
3 | 3 | import wradlib as wrl |
|
4 | 4 | import warnings |
|
5 | 5 | # libreia nueva |
|
6 | #export WRADLIB_DATA="/home/soporte/Downloads/2014-06-09--185000.rhi.mvol" | |
|
6 | 7 | from mpl_toolkits.axisartist.grid_finder import FixedLocator, DictFormatter |
|
7 | 8 | warnings.filterwarnings('ignore') |
|
8 | 9 | # lectura de gaMIC hdf5 file |
|
9 | 10 | filename = wrl.util.get_wradlib_data_file("/home/soporte/Downloads/2014-06-09--185000.rhi.mvol") |
|
10 | 11 | data1, metadata = wrl.io.read_gamic_hdf5(filename) |
|
11 | 12 | print(data1) |
|
12 | 13 | data1 = data1['SCAN0']['ZH']['data'] |
|
13 | 14 | print(data1) |
|
14 | 15 | print("SHAPE Data",np.array(data1).shape) |
|
15 | 16 | r = metadata['SCAN0']['r'] |
|
16 | 17 | print("r",r) |
|
17 | 18 | print("longitud r",len(r)) |
|
18 | 19 | th = metadata['SCAN0']['el'] |
|
19 | 20 | print("th",th) |
|
20 | 21 | print("longitud th",len(th)) |
|
21 | 22 | az = metadata['SCAN0']['az'] |
|
22 | 23 | print("az",az) |
|
23 | 24 | site = (metadata['VOL']['Longitude'], metadata['VOL']['Latitude'], |
|
24 | 25 | metadata['VOL']['Height']) |
|
25 | 26 | |
|
26 | 27 | print("Longitud,Latitud,Altura",site) |
|
27 | 28 | ma1 = np.array(data1) |
|
28 | 29 | ''' |
|
29 | 30 | mask_ind = np.where(data1 <= np.nanmin(data1)) |
|
30 | 31 | data1[mask_ind] = np.nan |
|
31 | 32 | ma1 = np.ma.array(data1, mask=np.isnan(data1)) |
|
32 | 33 | ''' |
|
33 | 34 | #cgax, pm = wrl.vis.plot_rhi(ma1,r=r,th=th,rf=1e3) |
|
34 | 35 | fig = plt.figure(figsize=(10,8)) |
|
35 | 36 | cgax, pm = wrl.vis.plot_rhi(ma1,r=r,th=th,rf=1e3,fig=fig, ax=111,proj='cg') |
|
36 | 37 | caax = cgax.parasites[0] |
|
37 | 38 | paax = cgax.parasites[1] |
|
38 | 39 | cgax.set_ylim(0, 14) |
|
39 | 40 | #caax = cgax.parasites[0] |
|
40 | 41 | #paax = cgax.parasites[1] |
|
41 | 42 | #cgax, pm = wrl.vis.plot_rhi(ma1, r=r, th=th, rf=1e3, fig=fig, ax=111, proj='cg') |
|
42 | 43 | txt = plt.title('Simple RHI',y=1.05) |
|
43 | 44 | #cbar = plt.gcf().colorbar(pm, pad=0.05, ax=paax) |
|
44 | 45 | cbar = plt.gcf().colorbar(pm, pad=0.05) |
|
45 | 46 | cbar.set_label('reflectivity [dBZ]') |
|
46 | 47 | caax.set_xlabel('x_range [km]') |
|
47 | 48 | caax.set_ylabel('y_range [km]') |
|
48 | 49 | plt.text(1.0, 1.05, 'azimuth', transform=caax.transAxes, va='bottom',ha='right') |
|
49 | 50 | gh = cgax.get_grid_helper() |
|
50 | 51 | |
|
51 | 52 | # set theta to some nice values |
|
52 | 53 | locs = [0., 1., 2., 3., 4., 5., 6., 7., 8., 9., 10., 11., 12., 13., 14., |
|
53 | 54 | 15., 16., 17., 18., 20., 22., 25., 30., 35., 40., 50., 60., 70., 80., 90.] |
|
54 | 55 | gh.grid_finder.grid_locator1 = FixedLocator(locs) |
|
55 | 56 | gh.grid_finder.tick_formatter1 = DictFormatter(dict([(i, r"${0:.0f}^\circ$".format(i)) for i in locs])) |
|
56 | 57 | |
|
57 | 58 | plt.show() |
General Comments 0
You need to be logged in to leave comments.
Login now