Compare commits
	
		
			No commits in common. "72574b1faf4ddfc52f5cd34d37f17a620c68a957" and "8acce6d76a67765798dc2f0deedaf667aabec587" have entirely different histories.
		
	
	
		
			72574b1faf
			...
			8acce6d76a
		
	
		
					 5 changed files with 16 additions and 29 deletions
				
			
		|  | @ -23,8 +23,8 @@ RUN sqlite3 -init /tmp/xmet.sql /var/lib/xmet/xmet.db .quit | |||
| 
 | ||||
| RUN /var/opt/xmet/bin/xmet-db-init \ | ||||
|  /var/lib/xmet/xmet.db \ | ||||
|  --radars-tsv /tmp/radars.tsv \ | ||||
|  --wfo-tsv /tmp/wfo.tsv \ | ||||
|  --igra-stations /tmp/igra2-station-list.txt | ||||
|  /tmp/radars.tsv \ | ||||
|  /tmp/wfo.tsv \ | ||||
|  /tmp/igra2-station-list.txt | ||||
| 
 | ||||
| ENTRYPOINT ["/var/opt/xmet/bin/xmet-nexrad-archive", "/var/lib/xmet/xmet.db"] | ||||
|  |  | |||
							
								
								
									
										5
									
								
								Makefile
									
										
									
									
									
								
							
							
						
						
									
										5
									
								
								Makefile
									
										
									
									
									
								
							|  | @ -9,6 +9,7 @@ DB_INIT		= ./bin/xmet-db-init | |||
| DB_INIT_RADARS	= doc/radars.tsv | ||||
| DB_INIT_WFO	= doc/wfo.tsv | ||||
| DB_INIT_IGRA	= doc/igra2-station-list.txt | ||||
| DB_INIT_FILES	= $(DB_INIT_RADARS) $(DB_INIT_WFO) $(DB_INIT_IGRA) | ||||
| 
 | ||||
| all: | ||||
| 	$(DOCKER) image build --tag $(DOCKER_TAG) . | ||||
|  | @ -16,9 +17,7 @@ all: | |||
| db-init: | ||||
| 	$(RM) $(SQLITE_DB) | ||||
| 	$(SQLITE) -init $(SQLITE_SCHEMA) $(SQLITE_DB) .quit | ||||
| 	$(DB_INIT) $(SQLITE_DB) --radars-tsv $(DB_INIT_RADARS) \
 | ||||
| 	                        --wfo-tsv $(DB_INIT_WFO) \
 | ||||
| 	                        --igra-stations $(DB_INIT_IGRA) | ||||
| 	$(DB_INIT) $(SQLITE_DB) $(DB_INIT_FILES) | ||||
| 
 | ||||
| clean: | ||||
| 	$(DOCKER) rmi $(DOCKER_TAG) | ||||
|  |  | |||
|  | @ -11,11 +11,10 @@ parser = argparse.ArgumentParser( | |||
|     description = 'Initialize NEXRAD radar site database table' | ||||
| ) | ||||
| 
 | ||||
| parser.add_argument('db', help='Path to SQLite3 database') | ||||
| 
 | ||||
| parser.add_argument('--radars-tsv',    type=str, help='Path to NEXRAD radar station TSV file') | ||||
| parser.add_argument('--wfo-tsv',       type=str, help='Path to forecast office TSV file') | ||||
| parser.add_argument('--igra-stations', type=str, help='Path to IGRA station list') | ||||
| parser.add_argument('db',            help='Path to SQLite3 database') | ||||
| parser.add_argument('radars-tsv',    help='Path to NEXRAD radar station TSV file') | ||||
| parser.add_argument('wfo-tsv',       help='Path to forecast office TSV file') | ||||
| parser.add_argument('igra-stations', help='Path to IGRA station list') | ||||
| 
 | ||||
| args = parser.parse_args() | ||||
| 
 | ||||
|  | @ -23,16 +22,13 @@ db = Database.connect(args.db) | |||
| 
 | ||||
| db.execute('begin transaction') | ||||
| 
 | ||||
| if args.radars_tsv is not None: | ||||
|     for radar in Radar.each_from_tsv(args.radars_tsv): | ||||
|         db.add(radar) | ||||
| for radar in Radar.each_from_tsv(getattr(args, 'radars-tsv')): | ||||
|     db.add(radar) | ||||
| 
 | ||||
| if args.wfo_tsv is not None: | ||||
|     for wfo in WFO.each_from_tsv(args.wfo_tsv): | ||||
|         db.add(wfo) | ||||
| for wfo in WFO.each_from_tsv(getattr(args, 'wfo-tsv')): | ||||
|     db.add(wfo) | ||||
| 
 | ||||
| if args.igra_stations is not None: | ||||
|     for station in IGRAStation.each_from_file(args.igra_stations): | ||||
|         db.add(station) | ||||
| for station in IGRAStation.each_from_file(getattr(args, 'igra-stations')): | ||||
|     db.add(station) | ||||
| 
 | ||||
| db.commit() | ||||
|  |  | |||
|  | @ -95,7 +95,7 @@ create table xmet_igra_station ( | |||
|     year_start INTEGER NOT NULL, | ||||
|     year_end   INTEGER NOT NULL, | ||||
|     name       TEXT NOT NULL, | ||||
|     state      TEXT, | ||||
|     state      TEXT NOT NULL, | ||||
|     elevation  FLOAT NOT NULL | ||||
| ); | ||||
| 
 | ||||
|  | @ -113,9 +113,6 @@ create table xmet_sounding ( | |||
|     data_source_other    TEXT NOT NULL | ||||
| ); | ||||
| 
 | ||||
| create index xmet_sounding_station_idx                     on xmet_sounding (station); | ||||
| create index xmet_sounding_timestamp_observed_released_idx on xmet_sounding (timestamp_observed, timestamp_released); | ||||
| 
 | ||||
| select AddGeometryColumn('xmet_sounding', 'location', 4326, 'POINT'), | ||||
|        CreateSpatialIndex('xmet_sounding', 'location'); | ||||
| 
 | ||||
|  | @ -137,6 +134,4 @@ create table xmet_sounding_sample ( | |||
|     FOREIGN KEY (sounding_id) REFERENCES xmet_sounding (id) | ||||
| ); | ||||
| 
 | ||||
| create index xmet_sounding_sample_sounding_id_idx on xmet_sounding_sample (sounding_id); | ||||
| 
 | ||||
| commit; | ||||
|  |  | |||
|  | @ -243,9 +243,6 @@ class IGRAStation(DatabaseTable): | |||
|         station.elevation  = float(cols(line, 32, 37)) | ||||
|         station.location   = shapely.Point(lon, lat) | ||||
| 
 | ||||
|         if station.state == '': | ||||
|             station.state = None | ||||
| 
 | ||||
|         return station | ||||
| 
 | ||||
|     @staticmethod | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue