return flux if __name__== "__main__": # -------------- Here's how to create a satellite and take some flux measurements: ------------- #GLD_root = 'alex/array/home/Vaisala/feed_data/GLD' #NLDN_root = 'alex/array/home/Vaisala/feed_data/NLDN' GLD_root = 'GLD' sat_TLE = ["1 40378U 15003C 15293.75287141 .00010129 00000-0 48835-3 0 9990", "2 40378 99.1043 350.5299 0153633 201.4233 158.0516 15.09095095 39471"] # Satellite object: sat = Satellite(sat_TLE[0], sat_TLE[1],'Firebird 4') # Measurement object: f = measurement_model(database = "database_dicts.pkl", GLD_root = GLD_root, multiple_bands = True) # ---- Do The Thing: inTime = "2015-11-01T00:45:00" plottime = datetime.datetime.strptime(inTime, "%Y-%m-%dT%H:%M:%S") sat.compute(plottime) sat.coords.transform_to('geomagnetic') # bands is a list of energy bands to sample at (depending on database, 1 thru 8) print "From banded measurement (all on):" print f.get_measurement(plottime, sat.coords, mode='banded',bands=f.m.E_bands) print "From single measurement:" print f.get_measurement(plottime, sat.coords, mode='continuous',bands=f.m.E_bands)
odb['gActs'] = gActs odb['previous_measurements'] = previous_measurements odb['stored_policy'] = stored_policy odb['num_lats'] = num_lats odb['num_lons'] = num_lons odb['num_times']= num_times with open(outDir + '/odb.pkl','wb') as file: pickle.dump(odb, file) sat.compute(cur_time) # Get time scaling weights: time_weight = get_time_scaling(gTimes, sat.coords, cur_time) sat.coords.transform_to('geomagnetic') # Get distance interpolating weights: map_weights = get_map_scaling(gLats, gLons, sat.coords, Rmax=smoothing_radius) # 3d weight (lat, lon, time): W = map_weights[:,:,None]*time_weight print "W isnans: ",np.sum(np.isnan(W)) print "Q isnans: ",np.sum(np.isnan(Q)) action = gActs[0] print "Starting run from ", cur_time ind = 0 # iteration counter