def create_map(start, end, ar_obs, ar_instr, sp_obs, sp_instr): # setting active regions data = DataAccess(start, end, 'AR', ar_obs, ar_instr) chain_encoded = prep.decode_and_split(data.get_chain_code()) ar_carr_synthesis, ar_pix_synthesis = ar.get_shapes(chain_encoded, data.get_pixel_start_x(), data.get_pixel_start_y(), data.get_filename(), data.get_noaa_number(), data.get_ar_id(), data.get_date()) # setting sunspots sp_data = DataAccess(start, end, 'SP', sp_obs, sp_instr) sp_chain_encoded = prep.decode_and_split(sp_data.get_chain_code()) sp_carr, sp_pix = sp.get_shapes(sp_chain_encoded, sp_data.get_pixel_start_x(), sp_data.get_pixel_start_y(), sp_data.get_filename(), sp_data.get_sp_id(), sp_data.get_date()) sp_synthesis = sp.make_sp_synthesis(ar_contour=ar_carr_synthesis, sp_carr=sp_carr) prep.display_object(ar_carr_synthesis, sp_synthesis)
ax.add_collection(p) # push grid lines behind the elements ax.set_axisbelow(True) plt.show() if __name__ == '__main__': from DataAccess import DataAccess data = DataAccess('2010-01-01T00:03:02', '2010-01-01T04:03:02') chain_encoded = encode_and_split(data.get_chain_code()) cords2 = get_shapes(chain_encoded, data.get_pixel_start_x(), data.get_pixel_start_y(), "2.fits") display_object(cords2) # # coordinates - numpy array with coordinates of the contour of the object # # Function convets from pixel coordinates to carrington # # Return - numpy array with carrington coordinates # def convert_to_carrington(coordinates, filename): # np_carrington_array = [] # # for c in coordinates: # np_contour = np.array(c) # Convert list to numpy array # rows = np_contour.shape[0] # get number of rows # # map = sunpy.map.Map(filename) #
for chains in chain_codes: if type(chains) is bytes: chains = chains.decode("utf-8") splitted_chain = list(map(int, str(chains))) codes.append(splitted_chain) return codes if __name__ == '__main__': # http://voparis-helio.obspm.fr/hfc-gui/showmap.php?date=2010-01-01%2000:03:02&feat=ar&style=pixel # http://voparis-helio.obspm.fr/helio-hfc/HelioQueryService?FROM=VIEW_AR_HQI&STARTTIME=2010-01-01T00:00:00&ENDTIME=2010-01-01T01:00:00&WHERE=OBSERVAT,SOHO;INSTRUME,MDI from DataAccess import DataAccess data = DataAccess('2010-01-01T00:00:00', '2010-01-01T02:59:00', 'AR') chain_encoded = encode_and_split([data.get_chain_code()[0]]) sp_data = DataAccess('2010-01-01T00:00:00', '2010-01-01T02:59:00', 'SP') sp_chain = encode_and_split([sp_data.get_chain_code()[0]]) ar = chain_code(chain_encoded[0], data.get_pixel_start_x()[0], data.get_pixel_start_y()[0]) sp = chain_code(sp_chain[0], sp_data.get_pixel_start_x()[0], sp_data.get_pixel_start_y()[0]) draw(ar, sp)
break return sunspots if __name__ == '__main__': # Active region + Sunspot testing from DataAccess import DataAccess import ActiveRegion as ar # setting active regions data = DataAccess('2003-10-21T00:00:00', '2003-10-24T00:00:00', 'AR', 'SOHO', 'MDI') chain_encoded = prep.decode_and_split(data.get_chain_code()) ar_carr_synthesis, ar_pix_synthesis = ar.get_shapes( chain_encoded, data.get_pixel_start_x(), data.get_pixel_start_y(), data.get_filename(), data.get_noaa_number(), data.get_ar_id(), data.get_date()) # setting sunspots sp_data = DataAccess('2003-10-21T00:00:00', '2003-10-24T00:00:00', 'SP', 'SOHO', 'MDI') sp_chain_encoded = prep.decode_and_split(sp_data.get_chain_code()) sp_carr, sp_pix = get_shapes(sp_chain_encoded, sp_data.get_pixel_start_x(), sp_data.get_pixel_start_y(), sp_data.get_filename(), sp_data.get_sp_id(), sp_data.get_date()) sp_synthesis = make_sp_synthesis(ar_contour=ar_carr_synthesis,
ar.append([xpos, ypos]) print("AR", ar) return ar if __name__ == '__main__': from DataAccess import DataAccess data = DataAccess('2003-09-27T00:00:00', '2003-09-29T00:00:00', 'FIL') chain_encoded = prep.encode_and_split(data.get_chain_code()) mer = get_shapes(chain_encoded, data.get_pixel_start_x(), data.get_pixel_start_y(), data.get_filename(), data.get_track_id(), data.get_fil_id(), data.get_date()) make_synthesis(mer) # for id, coords in mer.items(): # carrington.append(coords[0][0]) # for x in range(1,6): # carrington.append(mer["50988"][x][0]) # # prep.display_object(carrington, "") # npa = np.array([pix[0]], dtype=np.int32) # npa2 = np.array([pix[1]], dtype=np.int32) # print(npa)
ax.grid(which='both') # push grid lines behind the elements ax.set_axisbelow(True) for c in coordinates: #plt.scatter(c[0], c[1], marker='o', s=1) plt.fill(c[0], c[1]) plt.show() if __name__ == '__main__': from DataAccess import DataAccess data = DataAccess('2011-07-30T00:00:24', '2011-07-30T00:00:24') chain_encoded = encode_and_split(data.get_chain_code()) cords2 = get_shapes(chain_encoded, data.get_pixel_start_x(), data.get_pixel_start_y(), "aia1.fits") # test = [[123,3556,342,324,234], [144,4], [144,4], [144,4], [144,4], [144,4]] # nid = np.array(data.get_track_id()) # ar_id = merge_id_with_ar(cords2, data.get_track_id(), data.get_filename()) # # syn = make_synthesis(ar_id) a = add_to_database(cords2[0]) display_object(a)
from DataAccess import DataAccess data = DataAccess('2010-01-01T00:00:00', '2010-01-01T23:59:00', 'AR') data2 = DataAccess('2010-01-01T00:00:00', '2010-01-01T23:59:00', 'SP') chain_encoded = encode_and_split(data.get_chain_code()) chain_encoded2 = encode_and_split(data2.get_chain_code()) # cords3 = get_shapes(chain_encoded, data.get_pixel_start_x(), data.get_pixel_start_y(), data.get_filename(), # data.get_noaa_number(), data.get_ar_id(), data.get_date()) # # cords2 = get_shapes(chain_encoded2, data2.get_pixel_start_x(), data2.get_pixel_start_y(), data2.get_filename(), data2.get_noaa_number(), # data2.get_sp_id(), data2.get_date()) ar_coord = get_shapes2(chain_encoded, data.get_pixel_start_x(), data.get_pixel_start_y()) sp_coord = get_shapes2(chain_encoded2, data2.get_pixel_start_x(), data2.get_pixel_start_y()) make_sp_synthesis(ar_coord, sp_coord) # test = [[123,3556,342,324,234], [144,4], [144,4], [144,4], [144,4], [144,4]] # nid = np.array(data.get_track_id()) # ar_id = merge_id_with_ar(cords2, data.get_track_id(), data.get_filename()) # # syn = make_synthesis(ar_id) # a = add_to_database(cords2[0]) # # dat = encode_date(data.get_date())