| #!/usr/bin/python3 | |
| import json | |
| defLLR(): | |
| table = [] | |
| llr_table = [] | |
| withopen('MODIS_C6_Global_24h.json', 'r') as data_file: | |
| for line in data_file: | |
| try: | |
| j = line.split('|')[-1] | |
| table.append(json.loads(j)) | |
| exceptValueError: | |
| print("Bad Json File!") | |
| continue | |
| for row in table: | |
| lon =float(row['longitude']) | |
| lat =float(row['latitude']) | |
| scan = row['scan'] | |
| track = row['track'] | |
| radius = (float(scan) *float(track) /2) *750#kilometers | |
| radius =round(radius, 2) #round to two decimal places | |
| stroke_color ="FF0000" | |
| fill_color ="FF0000" | |
| llr_table.append([{ | |
| 'center': {'lng': lon, | |
| 'lat': lat}, | |
| 'radius': radius, | |
| 'infobox': 'MODIS Wildfire Detection Area'}]) | |
| llr_table.append(',') | |
| return llr_table | |
| LLRTABLE= LLR() | |
| print(len(LLRTABLE)) | |
| #print(LLRTABLE[0]) | |
| i =0 | |
| while i <len(LLRTABLE): | |
| print(LLRTABLE[i]) | |
| i+=1 | |
 Seth Wahle
Seth Wahleloading 20k +/- circles onto a map is proving to be a difficult task. hitting computing power limitations. were going to have to refactor how we are doing this if its ever going to work on a cell phone.
 Seth Wahle
Seth WahleProject Firewatch API is Live at: http://45.32.218.91:5001/api/
 Seth Wahle
Seth WahleFire Mapping service prototype is live at http://45.32.218.91:5000/fullmap
 Seth Wahle
Seth Wahlejust finished the project video
 Seth Wahle
Seth WahleDutch completed the database for MODIS's active fire data!
 Chung-thuy Pham
Chung-thuy Pham| import csv | |
| import json | |
| import click | |
| @click.group() | |
| defcli(*args, **kwargs): | |
| """Command line utility to easily convert .csv data over to .json data. This utility was built for the NASA space apps challenge and is defaulted | |
| to be used with cron to pull in data from https://earthdata.nasa.gov/earth-observation-data/near-real-time/firms/active-fire-data convert it to json | |
| and load it into a database to overcome the lack of a useable api for this data. | |
| Usage: python3 csv-json.py convert -i <input file path> -o <output file path>""" | |
| pass | |
| @click.command(help='Covert data from csv to json.') | |
| @click.option('--input', '-i', default='MODIS_C6_Global_24h.csv', help='--input , -iSets the file that is to be converted') | |
| @click.option('--output', '-o', default='MODIS_C6_Global_24h.json', help='--output, -o, Sets the name of the output.') | |
| defconvert(input, output): | |
| csvfile =open(input, 'r') | |
| jsonfile =open(output, 'w') | |
| reader = csv.DictReader( csvfile) | |
| for row in reader: | |
| json.dump(row, jsonfile) | |
| jsonfile.write('\n') | |
| cli.add_command(convert) | |
| if__name__=='__main__': | |
| cli() | 
 Seth Wahle
Seth WahleGithub is up and running https://github.com/osteth/project-firewatch
 Seth Wahle
Seth WahleProblem #1 NASA fire data doesn't have an API. time to build one....
 Seth Wahle
Seth WahleJust got to the STEAM WORKS, its a pretty cool space for the challenge! getting computers and everything set up with the team and starting to BUILD!!
 Seth Wahle
Seth Wahle
 Seth Wahle
Seth WahleSpaceApps is a NASA incubator innovation program.