print '>> Reading the fire mesh <<' sys.stdout.flush() fxlon, fxlat, bbox, time_esmf = read_fire_mesh(argument[0]) print '' print '>> Retrieving satellite data <<' sys.stdout.flush() # converting times to ISO dti = dt.datetime.strptime(sys.argv[2], '%Y%m%d%H%M%S') time_start_iso = '%d-%02d-%02dT%02d:%02d:%02dZ' % ( dti.year, dti.month, dti.day, dti.hour, dti.minute, dti.second) dtf = dti + dt.timedelta(days=float(sys.argv[3])) time_final_iso = '%d-%02d-%02dT%02d:%02d:%02dZ' % ( dtf.year, dtf.month, dtf.day, dtf.hour, dtf.minute, dtf.second) time_iso = (time_start_iso, time_final_iso) data = retrieve_af_data(bbox, time_iso, appkey=appkey) if igns: print '' print '>> Creating ignitions <<' print igns data.update(process_ignitions(igns, bbox, time=time_iso)) if perim_exists: print '' print '>> Getting perimeters from %s <<' % perim_path data.update( process_infrared_perimeters(perim_path, bbox, time=time_iso)) if forecast_exists and not cloud: print '' print '>> Getting forecast from %s <<' % forecast_path data.update( process_forecast_slides_wrfout(forecast_path,
# sample data into mesh - Las Conchas # navigate to /glade/u/home/angelfc/project/lasconchas/simulation_large to access sample data from JPSSD import retrieve_af_data, read_fire_mesh, time_iso2num, data2json, write_csv, json2kml import saveload as sl fxlon,fxlat,bbox,time_esmf=read_fire_mesh('wrfout_d04_2011-06-26_12:00:00') # cannot get starting time from wrfout time_iso = ("2011-06-25T00:00:00Z", "2011-07-04T00:00:00Z") # tuple, not array data=retrieve_af_data(bbox,time_iso) print 'writting CSV and KML with detections' keys=['latitude','longitude','brightness','scan','track','acq_date','acq_time','satellite','instrument','confidence','bright_t31','frp','scan_angle'] dkeys=['lat_fire','lon_fire','brig_fire','scan_fire','track_fire','acq_date','acq_time','sat_fire','instrument','conf_fire','t31_fire','frp_fire','scan_angle_fire'] N=[len(data[d]['lat_fire']) for d in data] json=data2json(data,keys,dkeys,N) write_csv(json,bbox) prods={'AF':'Active Fires','FRP':'Fire Radiative Power'} json2kml(json,'fire_detections.kml',bbox,prods) print 'writting KML with ground' keys=['latitude','longitude','scan','track','acq_date','acq_time','satellite','instrument','scan_angle'] dkeys=['lat_nofire','lon_nofire','scan_nofire','track_nofire','acq_date','acq_time','sat_fire','instrument','scan_angle_nofire'] N=[len(data[d]['lat_nofire']) for d in data] json=data2json(data,keys,dkeys,N) prods={'NF':'No Fire'} json2kml(json,'nofire.kml',bbox,prods)
from JPSSD import retrieve_af_data import sys if len(sys.argv) != 7: print 'usage: ./get_data.sh lonmin lonmax latmin latmax timemin timemax' print 'example:' print './get_data.sh -132.86966 -102.0868788 44.002495 66.281204 2012-09-11T00:00:00Z 2012-09-12T00:00:00Z' sys.exit(1) bbox=[] for s in sys.argv[1:5]: print s bbox.append(float(s)) time = (sys.argv[5],sys.argv[6]) print 'bounding box is %s' % bbox print 'time interval is %s %s' % time retrieve_af_data(bbox,time) print 'Retrieved data written to Matlab file out.mat'