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)
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, sp_carr=sp_carr)
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) #
all_contours_carr.append(synthesis) all_contours_pix.append(pixel_coord) return all_contours_carr, all_contours_pix # Calculates average instensity of active regions # ar_intensities - array with ar intensities def calculate_average_ar_intensity(ar_intensities): sum = 0 # go through array of pixel values and add them for x in ar_intensities: sum += x average = sum / len(ar_intensities) # calculate average return average if __name__ == '__main__': # ActiveRegion + ObjectPreparation test from DataAccess import DataAccess ar_data = DataAccess('2003-10-21T00:00:00', '2003-10-24T00:00:00', 'AR', 'SOHO', 'MDI') ar_chain_encoded = prep.decode_and_split(ar_data.get_chain_code()) ar_carr_synthesis, ar_pix_synthesis = get_shapes(ar_chain_encoded, ar_data.get_pixel_start_x(), ar_data.get_pixel_start_y(), ar_data.get_filename(), ar_data.get_noaa_number(), ar_data.get_ar_id(), ar_data.get_date()) prep.display_object(ar_carr_synthesis, [])