| 2 | | function read_rain, yr_in, mo_in, dy_in, hr_in, mn_in |
| 3 | | |
| 4 | | year = STRING(yr_in,FORMAT='(I4.4)') |
| 5 | | month = STRING(mo_in,FORMAT='(I2.2)') |
| 6 | | day = STRING(dy_in,FORMAT='(I2.2)') |
| 7 | | hour = STRING(hr_in,FORMAT='(I2.2)') |
| 8 | | minute = STRING(mn_in,FORMAT='(I2.2)') |
| 9 | | |
| 10 | | fname = 'data/'+'twpcpoldarX1.00.'+year+month+day+'.'+hour+minute+ '00.raw.asc' |
| 11 | | if file_exist( fname+'.sav' ) then begin |
| 12 | | restore, fname+'.sav' |
| 13 | | print, "Loading from cache: " + fname |
| 14 | | return, s |
| 15 | | end |
| 16 | | openr, lun, fname, /GET_LUN |
| 17 | | print, "Reading and caching: " + fname |
| 18 | | |
| 19 | | datetime = '' |
| 20 | | readf, lun, datetime |
| 21 | | if datetime ne year+month+day+' '+hour+minute then $ |
| 22 | | MESSAGE, "Requested data/time do not match file internals", /CONTINUE |
| 23 | | readf, lun, lat, lon, xmin, xmax, nx, ymin, ymax, ny, zmin, zmax, nz |
| 24 | | |
| 25 | | data = fltarr( nx*2, ny, nz ) |
| 26 | | readf, lun, data |
| 27 | | |
| 28 | | class = data[ makex( 1, (nx*2)-1, 2 ), *, * ] |
| 29 | | data = TEMPORARY( data[ makex( 0, (nx*2)-1, 2 ), *, * ] ) |
| 30 | | |
| 31 | | s = {data: data, $ |
| 32 | | class: class, $ |
| 33 | | classtype: INDGEN(11), $ |
| 34 | | classname: ['unclassified', 'drizzle', 'rain', 'dry low density snow', $ |
| 35 | | 'dry high density snow', 'melting snow', 'dry graupel', $ |
| 36 | | 'wet graupel', 'small hail lt 2 cms', 'large hail gt 2 cms', $ |
| 37 | | 'rain hail mix' ], $ |
| 38 | | date: year+month+day, $ |
| 39 | | time: hour+minute, $ |
| 40 | | lat: lat, $ |
| 41 | | lon: lon } |
| 42 | | save, s, filename=fname+'.sav' |
| 43 | | free_lun, lun |
| 44 | | return, s |
| 45 | | end |
| 46 | | |
| 47 | | |
| 48 | | |
| 49 | | pro clouds, h0,h1, filename=filename |
| | 2 | pro clouds, h0,h1 |
| 82 | | rr = d.data * (d.class eq 2) |
| 83 | | |
| 84 | | data0 = arrconcat( data0, dd ) |
| 85 | | data1 =arrconcat( data1, cc ) |
| 86 | | rain = arrconcat( rain, rr ) |
| 87 | | time = arrconcat( time, d.time ) |
| | 22 | d = rec.data |
| | 23 | bad = where( d eq -99.9, nbad ) |
| | 24 | if nbad ne 0 then d[bad] = 0 |
| | 25 | data.dbz[ *,*,*, idx ] = d |
| | 26 | |
| | 27 | c = rec.class |
| | 28 | bad = where( c eq -9, nbad ) |
| | 29 | if nbad ne 0 then c[bad] = 0 |
| | 30 | data.class[ *,*,*, idx ] = c |
| | 31 | |
| | 32 | time = arrconcat( time, rec.time ) |
| | 33 | |
| | 34 | idx = idx+1 |