;---------;---------;---------;---------;---------;---------;---------;--------: ;---------;---------;---------;---------;---------;---------;---------;--------: ;File/Program ScanPlot3D ;2006/04/25 WCC ;This program reads RICO RHI data and produces iTool files (*.isv) ; providing a 3D visualization of velocity and reflectivity fields using iPlot. ; ;---------;---------;---------;---------;---------;---------;---------;--------: PRO ScanPlot3D ;---------;---------;---------;---------;---------;---------;---------;--------: ;Define the colors and device characteristics COMMON COLORS, R_orig, G_orig, B_orig, R_curr, G_curr, B_curr LOADCT,13 ;load the rainbow color table into the COMMON COLORS rgb_table = BYTARR(3,256) rgb_table[0,*] = R_orig[*] rgb_table[1,*] = G_orig[*] rgb_table[2,*] = B_orig[*] rgb_table[*,255] = [255,255,255] ;make top of color table white DEVICE, DECOMPOSED = 0 ;used for TrueColor displays ;---------;---------;---------;---------;---------;---------;---------;--------: ;Get the files to process files = DIALOG_PICKFILE(/MULTIPLE_FILES,GET_PATH=path,FILTER='*.met.rc.nc', $ TITLE='Please Select Files to Process') type = SIZE(files) IF type[0] EQ 0 THEN BEGIN PRINT, 'no files found' RETURN ENDIF ;---------;---------;---------;---------;---------;---------;---------;--------: ;Main file processing loop FOR j = 0, N_ELEMENTS(files)-1 DO BEGIN fileId = NCDF_OPEN(files[j], /NOWRITE) NCDF_ATTGET, fileId, /GLOBAL, "P3_mode", P3_mode ;get the processing mode ;Skip processing if not a mode 170 (covariance) file IF P3_mode NE 170 THEN BEGIN PRINT, files[i] + ' has mode ', P3_mode, '. Skipping ...' CONTINUE ENDIF PRINT, 'processing ' + files[j] ;Get various variables from the netCDF file ;nRec gets the number of records in the file timeId = NCDF_DIMID(fileId, 'Time') NCDF_DIMINQ, fileId, timeId, name, nRec ;nCells gets the number of range cells in the file cellId = NCDF_DIMID(fileId, 'maxCells') NCDF_DIMINQ, fileId, cellId, name, nCells ;define a data structure for field data dummy = {Fields, ve:FLTARR(nCells), c0:FLTARR(nCells), p0:FLTARR(nCells), z0:FLTARR(nCells), cve:FLTARR(nCells)} NCDF_VARGET, fileId, "base_time", baseTime timeString = unixTimetoString(baseTime) NCDF_VARGET, fileId, "lat", lati NCDF_VARGET, fileId, "lon", lon NCDF_VARGET, fileId, "altm", altm data = REPLICATE({Fields}, nRec) ;data will get all of the field data readAllData, fileId, data ;read all of the field data into data ;---------;---------;---------;---------;---------;---------;---------;--------: ;Filter the z0, ve and cve fields based on the p0 field and the c0 field mask = BYTARR(nRec,nCells) FOR i = 0, nRec-1 DO BEGIN badData = WHERE(data[i].p0[*] LT -120,count) ;discard data where p0 < -104 dBm IF count EQ 0 THEN CONTINUE data[i].z0[badData] = -9999 data[i].ve[badData] = -9999 data[i].cve[badData] = -9999 ENDFOR FOR i = 0, nRec-1 DO BEGIN badData = WHERE(data[i].c0[*] LT 0.3,count) ;discard data where c0 < 0.3 IF count EQ 0 THEN CONTINUE data[i].z0[badData] = -10000 data[i].ve[badData] = -10000 data[i].cve[badData] = -10000 ENDFOR ;---------;---------;---------;---------;---------;---------;---------;--------: lati = TRANSPOSE(lati) lon = TRANSPOSE(lon) altm = TRANSPOSE(altm) ; Calculate size of array to use based on extremes of lat and long minLon = MIN(lon[*,*]) maxLon = MAX(lon[*,*]) minLat = MIN(lati[*,*]) maxLat = MAX(lati[*,*]) delLon = maxLon - minLon delLat = maxLat - minLat ;---------;---------;---------;---------;---------;---------;---------;--------: ; Do 3D scatter plots of the raw data using iPlot nPoints = nRec * nCells IF delLon GT delLat THEN range=delLon ELSE range=delLat ;iPlot velocity Color = BYTSCL(data[*].cve[*],MIN=-12,MAX=12,TOP=254) badData = WHERE(Color[*] EQ 0,count) IF count GT 0 THEN Color[badData] = 255 Color = TRANSPOSE(Color) iPlot,lon[*],lati[*],altm[*],XRANGE=[minLon,minLon+range],YRANGE=[minLat,minLat+range], $ /SCATTER,VERT_COLORS=Color[*],RGB_TABLE=rgb_table,SYM_THICK=5,LOCATION=[0,0] ;---------;---------;---------;---------;---------;---------;---------;--------: ; Save the 3D iPlot idTool = ITGETCURRENT(TOOL=oTool) ;idTool gets object identifier, oTool gets object reference of iPlot outFile = path + '/NOAA-K-' + STRMID(timestring,0,4) + $ STRMID(timestring,5,2) + STRMID(timestring,8,2) + '.vel.' + $ STRING(j+1,FORMAT='(I04)') + '.isv' ;build path name annotate,oTool,timestring+' Corrected Velocity in m/s NOAA/ESRL' ExportIplotToIsv,oTool,outFile ;export the ISV file (3D visualization) OBJ_DESTROY,oTool ;---------;---------;---------;---------;---------;---------;---------;--------: ;iPlot reflectivity Color = BYTSCL(data[*].z0[*],MIN=-40,MAX=20,TOP=254) badData = WHERE(Color[*] EQ 0,count) IF count GT 0 THEN Color[badData] = 255 Color = TRANSPOSE(Color) iPlot,lon[*],lati[*],altm[*],XRANGE=[minLon,minLon+range],YRANGE=[minLat,minLat+range], $ /SCATTER,VERT_COLORS=Color[*],RGB_TABLE=rgb_table,SYM_THICK=5,LOCATION=[0,0] ;---------;---------;---------;---------;---------;---------;---------;--------: ; Save the 3D iPlot idTool = ITGETCURRENT(TOOL=oTool) ;idTool gets object identifier, oTool gets object reference of iPlot outFile = path + '/NOAA-K-' + STRMID(timestring,0,4) + $ STRMID(timestring,5,2) + STRMID(timestring,8,2) + '.refl.' + $ STRING(j+1,FORMAT='(I04)') + '.isv' ;build path name annotate,oTool,timestring+' Reflectivity in dBZ NOAA/ESRL' ExportIplotToIsv,oTool,outFile ;export the ISV file (3D visualization) OBJ_DESTROY,oTool NCDF_CLOSE, fileId ENDFOR ;End of Main File Processing Loop ;---------;---------;---------;---------;---------;---------;---------;--------: ; Plot a colorbar window kolorbar: winIndex = 0 WINDOW, winIndex, XSIZE=300, YSIZE=125, TITLE='Color Bars' colorbar, ncolors=256, divisions = 10, range = [-12, 12], $ position = [0.05, 0.73, 0.95, 0.79], title ='Velocity in m/s' colorbar, ncolors=256, divisions = 8, range = [-40, 20], $ position = [0.05, 0.20, 0.95, 0.26], title ='Reflectivity in dBZ' END ;---------;---------;---------;---------;---------;---------;---------;--------: ;---------;---------;---------;---------;---------;---------;---------;--------: