def params(flare,**kwargs): m2deg = 360./(2*3.1415926*6.96e8) if flare["event_coordunit"] == "degrees": flare_event_coord1 = flare['event_coord1'] flare_event_coord2 = flare['event_coord2'] elif flare["event_coordunit"] == "arcsec" or flare["event_coordunit"] == "arcseconds": info = pb0r(flare["event_starttime"]) flare_coords = convert_hcc_hg(#info["sd"] / 60.0, info["b0"], info["l0"], (flare['event_coord1'] / 3600.0), (flare['event_coord2'] / 3600.0)) flare_event_coord1 = flare_coords[0] flare_event_coord2 = flare_coords[1] """ Define the parameters we will use for the unraveling of the maps""" params = {"epi_lat": flare_event_coord2, #30., #degrees, HG latitude of wave epicenter "epi_lon": flare_event_coord1, #45., #degrees, HG longitude of wave epicenter #HG grid, probably would only want to change the bin sizes "lat_min": -90., "lat_max": 90., "lat_bin": 0.2, "lon_min": -180., "lon_max": 180., "lon_bin": 5., # #HPC grid, probably would only want to change the bin sizes "hpcx_min": -1025., "hpcx_max": 1023., "hpcx_bin": 2., "hpcy_min": -1025., "hpcy_max": 1023., "hpcy_bin": 2., "hglt_obs": 0, "rotation": 360. / (27. * 86400.), #degrees/s, rigid solar rotation } #params = { # "cadence": 12., #seconds # # "hglt_obs": 0., #degrees # "rotation": 360./(27.*86400.), #degrees/s, rigid solar rotation # # #Wave parameters that are initial conditions # "direction": 25., #degrees, measured CCW from HG +latitude # "epi_lat": 30., #degrees, HG latitude of wave epicenter # "epi_lon": 45., #degrees, HG longitude of wave epicenter # # #Wave parameters that can evolve over time # #The first element is constant in time # #The second element (if present) is linear in time # #The third element (if present) is quadratic in time # #Be very careful of non-physical behavior # "width": [90., 1.5], #degrees, full angle in azimuth, centered at 'direction' # "wave_thickness": [6.0e6*m2deg,6.0e4*m2deg], #degrees, sigma of Gaussian profile in longitudinal direction # "wave_normalization": [1.], #integrated value of the 1D Gaussian profile # "speed": [9.33e5*m2deg, -1.495e3*m2deg], #degrees/s, make sure that wave propagates all the way to lat_min for polynomial speed # # #Noise parameters # "noise_type": "Poisson", #can be None, "Normal", or "Poisson" # "noise_scale": 0.3, # "noise_mean": 1., # "noise_sdev": 1., # # "max_steps": 20, # # #HG grid, probably would only want to change the bin sizes # "lat_min": -90., # "lat_max": 90., # "lat_bin": 0.2, # "lon_min": -180., # "lon_max": 180., # "lon_bin": 5., # # #HPC grid, probably would only want to change the bin sizes # "hpcx_min": -1025., # "hpcx_max": 1023., # "hpcx_bin": 2., # "hpcy_min": -1025., # "hpcy_max": 1023., # "hpcy_bin": 2. #} return params
from sunpy.wcs import convert_hg_hcc, convert_hcc_hg from sunpy.coords import pb0r from sunpy.coords import rot_hcc dt = '2008-04-12' v = pb0r(dt) x = 200 y = 100 print '============' print 'Arcsecond location', x, y h1,h2 = convert_hcc_hg(v["sd"]/60.0, v["b0"], v["l0"], x/3600.0, y/3600.0) print 'Lat, lon', h1, h2 nx, ny = convert_hg_hcc(v["sd"]/60.0, v["b0"], v["l0"], h1, h2) print 'Roundtrip arcsec loc.', 3600*nx, 3600*ny #nx, ny = convert_hg_hcc(v["sd"]/60.0, v["b0"], v["l0"], h1, h2) #print nx*3600, ny*3600 nnx, nny = convert_hg_hcc(v["sd"]/60.0, v["b0"], v["l0"] , 10.931230, 48.717380) print nnx*3600, ny*3600 newx, newy = rot_hcc(x,y, tstart=dt, tend='2008-04-14') print newx, newy