Skip to content
Snippets Groups Projects
Commit d9e6fe95 authored by Nick Bearson's avatar Nick Bearson
Browse files

resolves a merge conflict from moving our meso sector checking around

parents 11c9763a 840520fe
No related branches found
No related tags found
1 merge request!26group inputs by minute and process accordingly
...@@ -77,7 +77,7 @@ def create_parser(): ...@@ -77,7 +77,7 @@ def create_parser():
"(default: print to screen).") "(default: print to screen).")
parser.add_argument('-o', '--output-dir', metavar='OUTPUT_DIR', parser.add_argument('-o', '--output-dir', metavar='OUTPUT_DIR',
default=os.getcwd(), help="output directory (default: use current directory)") default=os.getcwd(), help="output directory (default: use current directory)")
parser.add_argument('--goes-sector', default="full", choices=['full', 'conus', 'meso'], parser.add_argument('--goes-sector', default="full", choices=['full', 'conus', 'meso', 'meso1', 'meso2'],
help="If sector is meso, ctr_lon and ctr_lat \n" help="If sector is meso, ctr_lon and ctr_lat \n"
"are interpreted as the ctr_x and ctr_y of the fixed grid.\n" "are interpreted as the ctr_x and ctr_y of the fixed grid.\n"
"(default: full)") "(default: full)")
...@@ -154,8 +154,10 @@ def get_sector_shortstring(args): ...@@ -154,8 +154,10 @@ def get_sector_shortstring(args):
return 'F' return 'F'
elif args.goes_sector == 'conus': elif args.goes_sector == 'conus':
return 'C' return 'C'
elif args.goes_sector == 'meso': elif args.goes_sector == 'meso' or args.goes_sector == 'meso1':
return 'M1' return 'M1'
elif args.goes_sector == 'meso2':
return 'M2'
else: else:
raise RuntimeError("sector not recognized") raise RuntimeError("sector not recognized")
...@@ -196,7 +198,25 @@ def grid_setup(glm_files, args, work_dir=os.getcwd()): ...@@ -196,7 +198,25 @@ def grid_setup(glm_files, args, work_dir=os.getcwd()):
min_events = None min_events = None
min_groups = None min_groups = None
if args.goes_sector == "meso" and (args.ctr_lat == None or args.ctr_lon == None): if args.realtime:
if len(args.filenames) != 1:
log.error("realtime mode only accepts one input file")
exit(1)
glminfo = parse_glm_filename(os.path.basename(args.filenames[0]))
globstring = "{}_{}_{}_s{}*".format(glminfo[0], glminfo[1], glminfo[2], glminfo[3].strftime("%Y%j%H%M"))
fileglob = glob(os.path.join(os.path.dirname(args.filenames[0]), globstring))
if len(fileglob) != 3:
log.error("There are not (yet) three GLM files from this minute. This may be expected. Exiting.")
exit(0)
args.filenames = fileglob
for f in args.filenames:
if not os.path.exists(f):
log.error("Tried to grid file that does not exist: {}".format(f))
exit(1)
if "meso" in args.goes_sector and (args.ctr_lat == None or args.ctr_lon == None):
log.error("sector 'meso' requires --ctr-lat & --ctr-lon") log.error("sector 'meso' requires --ctr-lat & --ctr-lon")
exit(1) exit(1)
...@@ -214,18 +234,23 @@ def grid_setup(glm_files, args, work_dir=os.getcwd()): ...@@ -214,18 +234,23 @@ def grid_setup(glm_files, args, work_dir=os.getcwd()):
goes_position = get_goes_position(glm_files) goes_position = get_goes_position(glm_files)
if "meso" in args.goes_sector:
view = "meso"
else:
view = args.goes_sector
resln = get_resolution(args) resln = get_resolution(args)
view = get_GOESR_grid(position=goes_position, grid = get_GOESR_grid(position=goes_position,
view=args.goes_sector, view=view,
resolution=resln) resolution=resln)
nadir_lon = view['nadir_lon'] nadir_lon = grid['nadir_lon']
dx = dy = view['resolution'] dx = dy = grid['resolution']
nx, ny = view['pixelsEW'], view['pixelsNS'] nx, ny = grid['pixelsEW'], grid['pixelsNS']
geofixcs, grs80lla = get_GOESR_coordsys(sat_lon_nadir=nadir_lon) geofixcs, grs80lla = get_GOESR_coordsys(sat_lon_nadir=nadir_lon)
if 'centerEW' in view: if 'centerEW' in grid:
x_ctr, y_ctr = view['centerEW'], view['centerNS'] x_ctr, y_ctr = grid['centerEW'], grid['centerNS']
elif args.goes_sector == 'meso': elif view == 'meso':
# use ctr_lon, ctr_lat to get the center of the mesoscale FOV # use ctr_lon, ctr_lat to get the center of the mesoscale FOV
x_ctr, y_ctr, z_ctr = geofixcs.fromECEF( x_ctr, y_ctr, z_ctr = geofixcs.fromECEF(
*grs80lla.toECEF(args.ctr_lon, args.ctr_lat, 0.0)) *grs80lla.toECEF(args.ctr_lon, args.ctr_lat, 0.0))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment