##// END OF EJS Templates
BLTRParamreader ready
Juan C. Espinoza -
r1010:0630a39b8282
parent child
Show More
@@ -0,0 +1,364
1 '''
2 Created on Nov 9, 2016
3
4 @author: roj- LouVD
5 '''
6
7
8 import os
9 import sys
10 import time
11 import glob
12 import datetime
13 import numpy
14
15 from schainpy.model.proc.jroproc_base import ProcessingUnit
16 from schainpy.model.data.jrodata import Parameters
17 from schainpy.model.io.jroIO_base import JRODataReader, isNumber
18
19 FILE_HEADER_STRUCTURE = numpy.dtype([
20 ('FMN', '<u4'),
21 ('nrec', '<u4'),
22 ('fr_offset', '<u4'),
23 ('id', '<u4'),
24 ('site', 'u1', (32,))
25 ])
26
27 REC_HEADER_STRUCTURE = numpy.dtype([
28 ('rmn', '<u4'),
29 ('rcounter', '<u4'),
30 ('nr_offset', '<u4'),
31 ('tr_offset', '<u4'),
32 ('time', '<u4'),
33 ('time_msec', '<u4'),
34 ('tag', 'u1', (32,)),
35 ('comments', 'u1', (32,)),
36 ('lat', '<f4'),
37 ('lon', '<f4'),
38 ('gps_status', '<u4'),
39 ('freq', '<u4'),
40 ('freq0', '<u4'),
41 ('nchan', '<u4'),
42 ('delta_r', '<u4'),
43 ('nranges', '<u4'),
44 ('r0', '<u4'),
45 ('prf', '<u4'),
46 ('ncoh', '<u4'),
47 ('npoints', '<u4'),
48 ('polarization', '<i4'),
49 ('rx_filter', '<u4'),
50 ('nmodes', '<u4'),
51 ('dmode_index', '<u4'),
52 ('dmode_rngcorr', '<u4'),
53 ('nrxs', '<u4'),
54 ('acf_length', '<u4'),
55 ('acf_lags', '<u4'),
56 ('sea_to_atmos', '<f4'),
57 ('sea_notch', '<u4'),
58 ('lh_sea', '<u4'),
59 ('hh_sea', '<u4'),
60 ('nbins_sea', '<u4'),
61 ('min_snr', '<f4'),
62 ('min_cc', '<f4'),
63 ('max_time_diff', '<f4')
64 ])
65
66 DATA_STRUCTURE = numpy.dtype([
67 ('range', '<u4'),
68 ('status', '<u4'),
69 ('zonal', '<f4'),
70 ('meridional', '<f4'),
71 ('vertical', '<f4'),
72 ('zonal_a', '<f4'),
73 ('meridional_a', '<f4'),
74 ('corrected_fading', '<f4'), # seconds
75 ('uncorrected_fading', '<f4'), # seconds
76 ('time_diff', '<f4'),
77 ('major_axis', '<f4'),
78 ('axial_ratio', '<f4'),
79 ('orientation', '<f4'),
80 ('sea_power', '<u4'),
81 ('sea_algorithm', '<u4')
82 ])
83
84 class BLTRParamReader(JRODataReader, ProcessingUnit):
85 '''
86 Boundary Layer and Tropospheric Radar (BLTR) reader, Wind velocities and SNR from *.sswma files
87 '''
88
89 ext = '.sswma'
90
91 def __init__(self, **kwargs):
92
93 ProcessingUnit.__init__(self , **kwargs)
94
95 self.dataOut = Parameters()
96 self.counter_records = 0
97 self.flagNoMoreFiles = 0
98 self.isConfig = False
99 self.filename = None
100
101 def setup(self,
102 path=None,
103 startDate=None,
104 endDate=None,
105 ext=None,
106 startTime=datetime.time(0, 0, 0),
107 endTime=datetime.time(23, 59, 59),
108 timezone=0,
109 status_value=0,
110 **kwargs):
111
112 self.path = path
113 self.startTime = startTime
114 self.endTime = endTime
115 self.status_value = status_value
116
117 if self.path is None:
118 raise ValueError, "The path is not valid"
119
120 if ext is None:
121 ext = self.ext
122
123 self.search_files(self.path, startDate, endDate, ext)
124 self.timezone = timezone
125 self.fileIndex = 0
126
127 if not self.fileList:
128 raise Warning, "There is no files matching these date in the folder: %s. \n Check 'startDate' and 'endDate' "%(path)
129
130 self.setNextFile()
131
132 def search_files(self, path, startDate, endDate, ext):
133 '''
134 Searching for BLTR rawdata file in path
135 Creating a list of file to proces included in [startDate,endDate]
136
137 Input:
138 path - Path to find BLTR rawdata files
139 startDate - Select file from this date
140 enDate - Select file until this date
141 ext - Extension of the file to read
142
143 '''
144
145 print 'Searching file in %s ' % (path)
146 foldercounter = 0
147 fileList0 = glob.glob1(path, "*%s" % ext)
148 fileList0.sort()
149
150 self.fileList = []
151 self.dateFileList = []
152
153 for thisFile in fileList0:
154 year = thisFile[-14:-10]
155 if not isNumber(year):
156 continue
157
158 month = thisFile[-10:-8]
159 if not isNumber(month):
160 continue
161
162 day = thisFile[-8:-6]
163 if not isNumber(day):
164 continue
165
166 year, month, day = int(year), int(month), int(day)
167 dateFile = datetime.date(year, month, day)
168
169 if (startDate > dateFile) or (endDate < dateFile):
170 continue
171
172 self.fileList.append(thisFile)
173 self.dateFileList.append(dateFile)
174
175 return
176
177 def setNextFile(self):
178
179 file_id = self.fileIndex
180
181 if file_id == len(self.fileList):
182 print '\nNo more files in the folder'
183 print 'Total number of file(s) read : {}'.format(self.fileIndex + 1)
184 self.flagNoMoreFiles = 1
185 return 0
186
187 print '\n[Setting file] (%s) ...' % self.fileList[file_id]
188 filename = os.path.join(self.path, self.fileList[file_id])
189
190 dirname, name = os.path.split(filename)
191 self.siteFile = name.split('.')[0] # 'peru2' ---> Piura - 'peru1' ---> Huancayo or Porcuya
192 if self.filename is not None:
193 self.fp.close()
194 self.filename = filename
195 self.fp = open(self.filename, 'rb')
196 self.header_file = numpy.fromfile(self.fp, FILE_HEADER_STRUCTURE, 1)
197 self.nrecords = self.header_file['nrec'][0]
198 self.sizeOfFile = os.path.getsize(self.filename)
199 self.counter_records = 0
200 self.flagIsNewFile = 0
201 self.fileIndex += 1
202
203 return 1
204
205 def readNextBlock(self):
206
207 while True:
208 if self.counter_records == self.nrecords:
209 self.flagIsNewFile = 1
210 if not self.setNextFile():
211 return 0
212
213 self.readBlock()
214
215 if (self.datatime.time() < self.startTime) or (self.datatime.time() > self.endTime):
216 print "[Reading] Record No. %d/%d -> %s [Skipping]" %(
217 self.counter_records,
218 self.nrecords,
219 self.datatime.ctime())
220 continue
221 break
222
223 print "[Reading] Record No. %d/%d -> %s" %(
224 self.counter_records,
225 self.nrecords,
226 self.datatime.ctime())
227
228 return 1
229
230 def readBlock(self):
231
232 pointer = self.fp.tell()
233 header_rec = numpy.fromfile(self.fp, REC_HEADER_STRUCTURE, 1)
234 self.nchannels = header_rec['nchan'][0]/2
235 self.kchan = header_rec['nrxs'][0]
236 self.nmodes = header_rec['nmodes'][0]
237 self.nranges = header_rec['nranges'][0]
238 self.fp.seek(pointer)
239 self.height = numpy.empty((self.nmodes, self.nranges))
240 self.snr = numpy.empty((self.nmodes, self.nchannels, self.nranges))
241 self.buffer = numpy.empty((self.nmodes, 3, self.nranges))
242
243 for mode in range(self.nmodes):
244 self.readHeader()
245 data = self.readData()
246 self.height[mode] = (data[0] - self.correction) / 1000.
247 self.buffer[mode] = data[1]
248 self.snr[mode] = data[2]
249
250 self.counter_records = self.counter_records + self.nmodes
251
252 return
253
254 def readHeader(self):
255 '''
256 RecordHeader of BLTR rawdata file
257 '''
258
259 header_structure = numpy.dtype(
260 REC_HEADER_STRUCTURE.descr + [
261 ('antenna_coord', 'f4', (2, self.nchannels)),
262 ('rx_gains', 'u4', (self.nchannels,)),
263 ('rx_analysis', 'u4', (self.nchannels,))
264 ]
265 )
266
267 self.header_rec = numpy.fromfile(self.fp, header_structure, 1)
268 self.lat = self.header_rec['lat'][0]
269 self.lon = self.header_rec['lon'][0]
270 self.delta = self.header_rec['delta_r'][0]
271 self.correction = self.header_rec['dmode_rngcorr'][0]
272 self.imode = self.header_rec['dmode_index'][0]
273 self.antenna = self.header_rec['antenna_coord']
274 self.rx_gains = self.header_rec['rx_gains']
275 self.time1 = self.header_rec['time'][0]
276 tseconds = self.header_rec['time'][0]
277 local_t1 = time.localtime(tseconds)
278 self.year = local_t1.tm_year
279 self.month = local_t1.tm_mon
280 self.day = local_t1.tm_mday
281 self.t = datetime.datetime(self.year, self.month, self.day)
282 self.datatime = datetime.datetime.utcfromtimestamp(self.time1)
283
284 def readData(self):
285 '''
286 Reading and filtering data block record of BLTR rawdata file, filtering is according to status_value.
287
288 Input:
289 status_value - Array data is set to NAN for values that are not equal to status_value
290
291 '''
292
293 data_structure = numpy.dtype(
294 DATA_STRUCTURE.descr + [
295 ('rx_saturation', 'u4', (self.nchannels,)),
296 ('chan_offset', 'u4', (2 * self.nchannels,)),
297 ('rx_amp', 'u4', (self.nchannels,)),
298 ('rx_snr', 'f4', (self.nchannels,)),
299 ('cross_snr', 'f4', (self.kchan,)),
300 ('sea_power_relative', 'f4', (self.kchan,))]
301 )
302
303 data = numpy.fromfile(self.fp, data_structure, self.nranges)
304
305 height = data['range']
306 winds = numpy.array((data['zonal'], data['meridional'], data['vertical']))
307 snr = data['rx_snr'].T
308
309 winds[numpy.where(winds == -9999.)] = numpy.nan
310 winds[:, numpy.where(data['status'] != self.status_value)] = numpy.nan
311 snr[numpy.where(snr == -9999.)] = numpy.nan
312 snr[:, numpy.where(data['status'] != self.status_value)] = numpy.nan
313 snr = numpy.power(10, snr / 10)
314
315 return height, winds, snr
316
317 def set_output(self):
318 '''
319 Storing data from databuffer to dataOut object
320 '''
321
322 self.dataOut.time1 = self.time1
323 self.dataOut.data_SNR = self.snr
324 self.dataOut.height= self.height
325 self.dataOut.data_output = self.buffer
326 self.dataOut.utctimeInit = self.time1
327 self.dataOut.utctime = self.dataOut.utctimeInit
328 self.dataOut.counter_records = self.counter_records
329 self.dataOut.nrecords = self.nrecords
330 self.dataOut.useLocalTime = False
331 self.dataOut.paramInterval = 157
332 self.dataOut.timezone = self.timezone
333 self.dataOut.site = self.siteFile
334 self.dataOut.nrecords = self.nrecords
335 self.dataOut.sizeOfFile = self.sizeOfFile
336 self.dataOut.lat = self.lat
337 self.dataOut.lon = self.lon
338 self.dataOut.channelList = range(self.nchannels)
339 self.dataOut.kchan = self.kchan
340 # self.dataOut.nHeights = self.nranges
341 self.dataOut.delta = self.delta
342 self.dataOut.correction = self.correction
343 self.dataOut.nmodes = self.nmodes
344 self.dataOut.imode = self.imode
345 self.dataOut.antenna = self.antenna
346 self.dataOut.rx_gains = self.rx_gains
347 self.dataOut.flagNoData = False
348
349 def getData(self):
350 '''
351 Storing data from databuffer to dataOut object
352 '''
353 if self.flagNoMoreFiles:
354 self.dataOut.flagNoData = True
355 print 'No file left to process'
356 return 0
357
358 if not(self.readNextBlock()):
359 self.dataOut.flagNoData = True
360 return 0
361
362 self.set_output()
363
364 return 1
@@ -0,0 +1,375
1 '''
2 Created on Aug 1, 2017
3
4 @author: Juan C. Espinoza
5 '''
6
7 import os
8 import sys
9 import time
10 import datetime
11
12 import numpy
13
14 from schainpy.model.proc.jroproc_base import ProcessingUnit, Operation
15 from schainpy.model.data.jrodata import Parameters
16 from schainpy.model.data.jroheaderIO import RadarControllerHeader, SystemHeader
17 from schainpy.model.graphics.jroplot_parameters import WindProfilerPlot
18 from schainpy.model.io.jroIO_base import *
19
20 try:
21 import madrigal
22 import madrigal.cedar
23 from madrigal.cedar import MadrigalCatalogRecord
24 except:
25 print 'You should install "madrigal library" module if you want to read/write Madrigal data'
26
27
28 class MADWriter(Operation):
29
30 def __init__(self):
31
32 Operation.__init__(self)
33 self.dataOut = Parameters()
34 self.path = None
35 self.dataOut = None
36 self.flagIsNewFile=1
37 self.ext = ".hdf5"
38
39 return
40
41 def run(self, dataOut, path , modetowrite,**kwargs):
42
43 if self.flagIsNewFile:
44 flagdata = self.setup(dataOut, path, modetowrite)
45
46 self.putData()
47 return
48
49 def setup(self, dataOut, path, modetowrite):
50 '''
51 Recovering data to write in new *.hdf5 file
52 Inputs:
53 modew -- mode to write (1 or 2)
54 path -- destination path
55
56 '''
57
58 self.im = modetowrite-1
59 if self.im!=0 and self.im!=1:
60 raise ValueError, 'Check "modetowrite" value. Must be egual to 1 or 2, "{}" is not valid. '.format(modetowrite)
61
62 self.dataOut = dataOut
63 self.nmodes = self.dataOut.nmodes
64 self.nchannels = self.dataOut.nchannels
65 self.lat = self.dataOut.lat
66 self.lon = self.dataOut.lon
67 self.hcm = 3
68 self.thisDate = self.dataOut.utctimeInit
69 self.year = self.dataOut.year
70 self.month = self.dataOut.month
71 self.day = self.dataOut.day
72 self.path = path
73
74 self.flagIsNewFile = 0
75
76 return 1
77
78 def setFile(self):
79 '''
80 - Determining the file name for each mode of operation
81 kinst - Kind of Instrument (mnemotic)
82 kindat - Kind of Data (mnemotic)
83
84 - Creating a cedarObject
85
86 '''
87 lat_piura = -5.17
88 lat_huancayo = -12.04
89 lat_porcuya = -5.8
90
91 if '%2.2f' % self.lat == '%2.2f' % lat_piura:
92 self.instMnemonic = 'pbr'
93
94 elif '%2.2f' % self.lat == '%2.2f' % lat_huancayo:
95 self.instMnemonic = 'hbr'
96
97 elif '%2.2f' % self.lat == '%2.2f' % lat_porcuya:
98 self.instMnemonic = 'obr'
99 else: raise Warning, "The site of file read doesn't match any site known. Only file from Huancayo, Piura and Porcuya can be processed.\n Check the file "
100
101 mode = ['_mode1','_mode2']
102
103 self.hdf5filename = '%s%4.4d%2.2d%2.2d%s%s' % (self.instMnemonic,
104 self.year,
105 self.month,
106 self.day,
107 mode[self.im],
108 self.ext)
109
110 self.fullname=os.path.join(self.path,self.hdf5filename)
111
112 if os.path.isfile(self.fullname) :
113 print "Destination path '%s' already exists. Previous file deleted. " %self.fullname
114 os.remove(self.fullname)
115
116 # Identify kinst and kindat
117 InstName = self.hdf5filename[0:3]
118 KinstList = [1000, 1001, 1002]
119 KinstId = {'pbr':0, 'hbr':1, 'obr':2} # pbr:piura, hbr:huancayo, obr:porcuya
120 KindatList = [1600, 1601] # mode 1, mode 2
121 self.type = KinstId[InstName]
122 self.kinst = KinstList[self.type]
123 self.kindat = KindatList[self.im]
124
125 try:
126 self.cedarObj = madrigal.cedar.MadrigalCedarFile(self.fullname, True)
127 except ValueError, message:
128 print '[Error]: Impossible to create a cedar object with "madrigal.cedar.MadrigalCedarFile" '
129 return
130
131 return 1
132
133 def writeBlock(self):
134 '''
135 - Selecting mode of operation:
136
137 bltr high resolution mode 1 - Low Atmosphere (0 - 3km) // bltr high resolution mode 2 - High Atmosphere (0 - 10km)
138 msnr - Average Signal Noise Ratio in dB
139 hcm - 3 km
140
141 - Filling the cedarObject by a block: each array data entry is assigned a code that defines the parameter to write to the file
142
143 GDLATR - Reference geod latitude (deg)
144 GDLONR - Reference geographic longitude (deg)
145 GDLAT2 - Geodetic latitude of second inst (deg)
146 GLON2 - Geographic longitude of second inst (deg)
147
148 GDALT - Geodetic altitude (height) (km)
149 SNL - Log10 (signal to noise ratio)
150 VN1P2 - Neutral wind in direction 1 (eastward) (m/s), ie zonal wind
151 VN2P2 - Neutral wind in direction 2 (northward) (m/s), ie meridional wind
152 EL2 - Ending elevation angle (deg), ie vertical wind
153
154 Other parameters: /madrigal3/metadata/parcodes.tab
155
156 '''
157
158 self.z_zon = self.dataOut.data_output[0,:,:]
159 self.z_mer =self.dataOut.data_output[1,:,:]
160 self.z_ver = self.dataOut.data_output[2,:,:]
161
162 if self.im == 0:
163 h_select = numpy.where(numpy.bitwise_and(self.dataOut.height[0, :] >= 0., self.dataOut.height[0, :] <= self.hcm, numpy.isfinite(self.dataOut.height[0, :])))
164 else:
165 h_select = numpy.where(numpy.bitwise_and(self.dataOut.height[0, :] >= 0., self.dataOut.height[0, :] < 20, numpy.isfinite(self.dataOut.height[0, :])))
166
167 ht = h_select[0]
168
169 self.o_height = self.dataOut.height[self.im, ht]
170 self.o_zon = self.z_zon[ht, self.im]
171 self.o_mer = self.z_mer[ht, self.im]
172 self.o_ver = self.z_ver[ht, self.im]
173 o_snr = self.dataOut.data_SNR[ :, :, self.im]
174
175 o_snr = o_snr[ht, :]
176
177 ndiv = numpy.nansum((numpy.isfinite(o_snr)), 1)
178 ndiv = ndiv.astype(float)
179
180 sel_div = numpy.where(ndiv == 0.)
181 ndiv[sel_div] = numpy.nan
182
183 if self.nchannels > 1:
184 msnr = numpy.nansum(o_snr, axis=1)
185 else:
186 msnr = o_snr
187
188 try:
189 self.msnr = 10 * numpy.log10(msnr / ndiv)
190 except ZeroDivisionError:
191 self.msnr = 10 * numpy.log10(msnr /1)
192 print 'Number of division (ndiv) egal to 1 by default. Check SNR'
193
194 time_t = time.gmtime(self.dataOut.time1)
195 year = time_t.tm_year
196 month = time_t.tm_mon
197 day = time_t.tm_mday
198 hour = time_t.tm_hour
199 minute = time_t.tm_min
200 second = time_t.tm_sec
201 timedate_0 = datetime.datetime(year, month, day, hour, minute, second)
202
203 # 1d parameters
204 GDLATR = self.lat
205 GDLONR = self.lon
206 GDLAT2 = self.lat
207 GLON2 = self.lon
208
209 # 2d parameters
210 GDALT = self.o_height
211
212 SNL = self.msnr
213 VN1P2 = self.o_zon
214 VN2P2 = self.o_mer
215 EL2 = self.o_ver
216 NROW = len(self.o_height)
217
218 startTime = timedate_0
219 endTime = startTime
220 self.dataRec = madrigal.cedar.MadrigalDataRecord(self.kinst,
221 self.kindat,
222 startTime.year,
223 startTime.month,
224 startTime.day,
225 startTime.hour,
226 startTime.minute,
227 startTime.second,
228 0,
229 endTime.year,
230 endTime.month,
231 endTime.day,
232 endTime.hour,
233 endTime.minute,
234 endTime.second,
235 0,
236 ('gdlatr', 'gdlonr', 'gdlat2', 'glon2'),
237 ('gdalt', 'snl', 'vn1p2', 'vn2p2', 'el2'),
238 NROW, ind2DList=['gdalt'])
239
240 # Setting 1d values
241 self.dataRec.set1D('gdlatr', GDLATR)
242 self.dataRec.set1D('gdlonr', GDLONR)
243 self.dataRec.set1D('gdlat2', GDLAT2)
244 self.dataRec.set1D('glon2', GLON2)
245
246 # Setting 2d values
247 for n in range(self.o_height.shape[0]):
248 self.dataRec.set2D('gdalt', n, GDALT[n])
249 self.dataRec.set2D('snl', n, SNL[n])
250 self.dataRec.set2D('vn1p2', n, VN1P2[n])
251 self.dataRec.set2D('vn2p2', n, VN2P2[n])
252 self.dataRec.set2D('el2', n, EL2[n])
253
254 # Appending new data record
255 '''
256 [MADRIGAL3]There are two ways to write to a MadrigalCedarFile. Either this method (write) is called after all the
257 records have been appended to the MadrigalCedarFile, or dump is called after a certain number of records are appended,
258 and then at the end dump is called a final time if there were any records not yet dumped, followed by addArray.
259 '''
260
261 self.cedarObj.append(self.dataRec)
262 print ' [Writing] records {} (mode {}).'.format(self.dataOut.counter_records,self.im+1)
263 self.cedarObj.dump()
264
265
266
267
268 def setHeader(self):
269 '''
270 - Creating self.catHeadObj
271 - Adding information catalog
272 - Writing file header
273
274 '''
275 self.catHeadObj = madrigal.cedar.CatalogHeaderCreator(self.fullname)
276 kindatDesc, comments, analyst, history, principleInvestigator = self._info_BLTR()
277
278 self.catHeadObj.createCatalog(principleInvestigator="Jarjar",
279 expPurpose='characterize the atmospheric dynamics in this region where frequently it happens the El Nino',
280 sciRemarks="http://madrigal3.haystack.mit.edu/static/CEDARMadrigalHdf5Format.pdf")
281
282 self.catHeadObj.createHeader(kindatDesc, analyst, comments, history)
283
284 self.catHeadObj.write()
285
286 print '[File created] path: %s' % (self.fullname)
287
288 def putData(self):
289
290 if self.dataOut.flagNoData:
291 return 0
292
293 if self.dataOut.counter_records == 1:
294 self.setFile()
295 print '[Writing] Setting new hdf5 file for the mode {}'.format(self.im+1)
296
297 if self.dataOut.counter_records <= self.dataOut.nrecords:
298 self.writeBlock()
299
300
301 if self.dataOut.counter_records == self.dataOut.nrecords:
302 self.cedarObj.addArray()
303
304 self.setHeader()
305 self.flagIsNewFile = 1
306
307 def _info_BLTR(self):
308
309 kindatDesc = '''--This header is for KINDAT = %d''' % self.kindat
310 history = None
311 analyst = '''Jarjar'''
312 principleInvestigator = '''
313 Jarjar
314 Radio Observatorio de Jicamarca
315 Instituto Geofisico del Peru
316
317 '''
318 if self.type == 1:
319 comments = '''
320
321 --These data are provided by two Boundary Layer and Tropospheric Radar (BLTR) deployed at two different locations at Peru(GMT-5), one of them at Piura(5.17 S, 80.64W) and another located at Huancayo (12.04 S, 75.32 W).
322
323 --The purpose of conducting these observations is to measure wind in the differents levels of height, this radar makes measurements the Zonal(U), Meridional(V) and Vertical(W) wind velocities component in northcoast from Peru. And the main purpose of these mensurations is to characterize the atmospheric dynamics in this region where frequently it happens the 'El Nino Phenomenon'
324
325 --In Kindat = 1600, contains information of wind velocities component since 0 Km to 3 Km.
326
327 --In Kindat = 1601, contains information of wind velocities component since 0 Km to 10 Km.
328
329 --The Huancayo-BLTR is a VHF Profiler Radar System is a 3 channel coherent receiver pulsed radar utilising state-of-the-art software and computing techniques to acquire, decode, and translate signals obtained from partial reflection echoes in the troposphere, lower stratosphere and mesosphere. It uses an array of three horizontal spaced and vertically directed receiving antennas. The data is recorded thirty seconds, averaged to one minute mean values of Height, Zonal, Meridional and Vertical wind.
330
331 --The Huancayo-BLTR was installed in January 2010. This instrument was designed and constructed by Genesis Soft Pty. Ltd. Is constituted by three groups of spaced antennas (distributed) forming an isosceles triangle.
332
333
334 Station _______ Geographic Coord ______ Geomagnetic Coord
335
336 _______________ Latitude _ Longitude __ Latitude _ Longitude
337
338 Huancayo (HUA) __12.04 S ___ 75.32 W _____ -12.05 ____ 352.85
339 Piura (PIU) _____ 5.17 S ___ 80.64 W ______ 5.18 ____ 350.93
340
341 WIND OBSERVATIONS
342
343 --To obtain wind the BLTR uses Spaced Antenna technique (e.g., Briggs 1984). The scatter and reflection it still provided by variations in the refractive index as in the Doppler method(Gage and Basley,1978; Balsley and Gage 1982; Larsen and Rottger 1982), but instead of using the Doppler shift to derive the velocity components, the cross-correlation between signals in an array of three horizontally spaced and vertically directed receiving antennas is used.
344
345 ......................................................................
346 For more information, consult the following references:
347 - Balsley, B. B., and K. S. Gage., On the use of radars for operational wind profiling, Bull. Amer. Meteor.Soc.,63, 1009-1018, 1982.
348
349 - Briggs, B. H., The analysis of spaced sensor data by correations techniques, Handbook for MAP, Vol. 13, SCOTEP Secretariat, University of Illinois, Urbana, 166-186, 1984.
350
351 - Gage, K. S., and B.B. Balsley., Doppler radar probing of the clear atmosphere, Bull. Amer. Meteor.Soc., 59, 1074-1093, 1978.
352
353 - Larsen, M. F., The Spaced Antenna Technique for Radar Wind Profiling, Journal of Atm. and Ocean. Technology. , Vol.6, 920-937, 1989.
354
355 - Larsen, M. F., A method for single radar voracity measurements?, Handbook for MAP,SCOSTEP Secretariat, University of the Illinois, Urban, in press, 1989.
356 ......................................................................
357
358 ACKNOWLEDGEMENTS:
359
360 --The Piura and Huancayo BLTR are part of the network of instruments operated by the Jicamarca Radio Observatory.
361
362 --The Jicamarca Radio Observatory is a facility of the Instituto Geofisico del Peru operated with support from the NSF Cooperative Agreement ATM-0432565 through Cornell University
363
364 ......................................................................
365
366 Further questions and comments should be addressed to:
367 Radio Observatorio de Jicamarca
368 Instituto Geofisico del Peru
369 Lima, Peru
370 Web URL: http://jro.igp.gob.pe
371 ......................................................................
372 '''
373
374 return kindatDesc, comments, analyst, history, principleInvestigator
375
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -13,7 +13,7 from jroIO_kamisr import *
13 from jroIO_param import *
13 from jroIO_param import *
14 from jroIO_hf import *
14 from jroIO_hf import *
15
15
16 from bltrIO_param import *
16 from jroIO_bltr import *
17 from jroIO_bltr import *
17 from jroIO_mira35c import *
18 from jroIO_mira35c import *
18 from io_bltr_block import *
19
19
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -11,7 +11,6 import numpy
11 import fnmatch
11 import fnmatch
12 import inspect
12 import inspect
13 import time, datetime
13 import time, datetime
14 #import h5py
15 import traceback
14 import traceback
16
15
17 try:
16 try:
@@ -1058,10 +1057,10 class JRODataReader(JRODataIO):
1058
1057
1059 break
1058 break
1060
1059
1061 # if self.verbose:
1060 if self.verbose:
1062 # print "[Reading] Block No. %d/%d -> %s" %(self.nReadBlocks,
1061 print "[Reading] Block No. %d/%d -> %s" %(self.nReadBlocks,
1063 # self.processingHeaderObj.dataBlocksPerFile,
1062 self.processingHeaderObj.dataBlocksPerFile,
1064 # self.dataOut.datatime.ctime())
1063 self.dataOut.datatime.ctime())
1065 return 1
1064 return 1
1066
1065
1067 def __readFirstHeader(self):
1066 def __readFirstHeader(self):
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -10,10 +10,9 import matplotlib.pyplot as plt
10
10
11 import pylab as plb
11 import pylab as plb
12 from scipy.optimize import curve_fit
12 from scipy.optimize import curve_fit
13 from scipy import asarray as ar,exp
13 from scipy import asarray as ar, exp
14 from scipy import stats
14 from scipy import stats
15
15
16 from duplicity.path import Path
17 from numpy.ma.core import getdata
16 from numpy.ma.core import getdata
18
17
19 SPEED_OF_LIGHT = 299792458
18 SPEED_OF_LIGHT = 299792458
@@ -427,7 +426,7 class RecordHeaderBLTR(Header):
427 return 1
426 return 1
428
427
429
428
430 class BLTRReader (ProcessingUnit, FileHeaderBLTR, RecordHeaderBLTR, JRODataReader):
429 class BLTRSpectraReader (ProcessingUnit, FileHeaderBLTR, RecordHeaderBLTR, JRODataReader):
431
430
432 path = None
431 path = None
433 startDate = None
432 startDate = None
@@ -456,7 +455,7 class BLTRReader (ProcessingUnit, FileHeaderBLTR, RecordHeaderBLTR, JRODataReade
456 #Eliminar de la base la herencia
455 #Eliminar de la base la herencia
457 ProcessingUnit.__init__(self, **kwargs)
456 ProcessingUnit.__init__(self, **kwargs)
458
457
459 # self.isConfig = False
458 #self.isConfig = False
460
459
461 #self.pts2read_SelfSpectra = 0
460 #self.pts2read_SelfSpectra = 0
462 #self.pts2read_CrossSpectra = 0
461 #self.pts2read_CrossSpectra = 0
@@ -1151,43 +1150,5 class BLTRReader (ProcessingUnit, FileHeaderBLTR, RecordHeaderBLTR, JRODataReade
1151
1150
1152
1151
1153
1152
1154 class BLTRWriter(ProcessingUnit):
1153
1155 '''
1156 classdocs
1157 '''
1158
1159 def __init__(self):
1160 '''
1161 Constructor
1162 '''
1163 self.dataOut = None
1164
1165 self.isConfig = False
1166
1167 def setup(self, dataIn, path, blocksPerFile, set=0, ext=None):
1168 '''
1169 In this method we should set all initial parameters.
1170
1171 Input:
1172 dataIn : Input data will also be outputa data
1173
1174 '''
1175 self.dataOut = dataIn
1176
1177 self.isConfig = True
1178
1179 return
1180
1181 def run(self, dataIn, **kwargs):
1182 '''
1183 This method will be called many times so here you should put all your code
1184
1185 Inputs:
1186
1187 dataIn : object with the data
1188
1189 '''
1190
1191 if not self.isConfig:
1192 self.setup(dataIn, **kwargs)
1193
1154
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -13,7 +13,6 from scipy.optimize import curve_fit
13 from scipy import asarray as ar,exp
13 from scipy import asarray as ar,exp
14 from scipy import stats
14 from scipy import stats
15
15
16 from duplicity.path import Path
17 from numpy.ma.core import getdata
16 from numpy.ma.core import getdata
18
17
19 SPEED_OF_LIGHT = 299792458
18 SPEED_OF_LIGHT = 299792458
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -19,56 +19,44 import matplotlib.pyplot as plt
19 from matplotlib.mlab import griddata
19 from matplotlib.mlab import griddata
20
20
21
21
22
22 class BLTRParametersProc(ProcessingUnit):
23
24 class BLTRProcess(ProcessingUnit):
25 isConfig = False
26 '''
23 '''
27 Processing unit for BLTR rawdata
24 Processing unit for BLTR parameters data (winds)
28
25
29 Inputs:
26 Inputs:
30 self.dataOut.nmodes - Number of operation modes
27 self.dataOut.nmodes - Number of operation modes
31 self.dataOut.nchannels - Number of channels
28 self.dataOut.nchannels - Number of channels
32 self.dataOut.nranges - Number of ranges
29 self.dataOut.nranges - Number of ranges
33
30
34 self.dataOut.data_SNR - SNR array
31 self.dataOut.data_SNR - SNR array
35 self.dataOut.data_output - Zonal, Vertical and Meridional velocity array
32 self.dataOut.data_output - Zonal, Vertical and Meridional velocity array
36 self.dataOut.height - Height array (km)
33 self.dataOut.height - Height array (km)
37 self.dataOut.time - Time array (seconds)
34 self.dataOut.time - Time array (seconds)
38
35
39 self.dataOut.fileIndex -Index of the file currently read
36 self.dataOut.fileIndex -Index of the file currently read
40 self.dataOut.lat - Latitude coordinate of BLTR location
37 self.dataOut.lat - Latitude coordinate of BLTR location
41
38
42 self.dataOut.doy - Experiment doy (number of the day in the current year)
39 self.dataOut.doy - Experiment doy (number of the day in the current year)
43 self.dataOut.month - Experiment month
40 self.dataOut.month - Experiment month
44 self.dataOut.day - Experiment day
41 self.dataOut.day - Experiment day
45 self.dataOut.year - Experiment year
42 self.dataOut.year - Experiment year
46 '''
43 '''
47
44
48 def __init__(self, **kwargs):
45 def __init__(self, **kwargs):
49 '''
46 '''
50 Inputs: None
47 Inputs: None
51
52 '''
48 '''
53 ProcessingUnit.__init__(self, **kwargs)
49 ProcessingUnit.__init__(self, **kwargs)
54 self.dataOut = Parameters()
50 self.dataOut = Parameters()
55
51
56 # Filters
52 def run (self, mode):
57 snr_val = None
53 '''
58 value = None
54 '''
59 svalue2 = None
60 method = None
61 factor = None
62 filter = None
63 npoints = None
64 status_value = None
65 width = None
66 self.flagfirstmode = 0
67
68 def run (self):
69 if self.dataIn.type == "Parameters":
55 if self.dataIn.type == "Parameters":
70 self.dataOut.copy(self.dataIn)
56 self.dataOut.copy(self.dataIn)
71
57
58 self.dataOut.data_output = self.dataOut.data_output[mode]
59 self.dataOut.heightList = self.dataOut.height[mode]
72
60
73 def TimeSelect(self):
61 def TimeSelect(self):
74 '''
62 '''
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
This diff has been collapsed as it changes many lines, (950 lines changed) Show them Hide them
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now