Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. import astropy.units as u
  2. import matplotlib.pyplot as plt
  3. import numpy as np
  4. from astropy.coordinates import SkyCoord
  5. from reproject import reproject_interp
  6.  
  7.  
  8. import sunpy.map
  9. from sunpy.data.sample import HMI_LOS_IMAGE
  10.  
  11.  
  12. hmi = sunpy.map.Map(HMI_LOS_IMAGE)
  13.  
  14. new_data = np.empty((720, 1440))
  15. new_frame = SkyCoord(0*u.deg, 0*u.deg, obstime=hmi.date, frame="heliographic_stonyhurst")
  16. new_header = sunpy.map.make_fitswcs_header(new_data, new_frame,
  17. scale=[0.25, 0.25]*u.deg/u.pix,
  18. instrument="HMI",
  19. projection_code="CAR")
  20. new_header['DATE-OBS'] = hmi.date.fits
  21.  
  22. outmap = sunpy.map.Map(new_data, new_header)
  23.  
  24. # Update outmap with the reprojected version of the hmi data
  25. reproject_interp(hmi, outmap)
  26.  
  27. hmi.plot_settings['cmap'] = 'hmimag'
  28. hmi.plot_settings['norm'] = plt.Normalize(-1500, 1500)
  29. outmap.plot_settings = hmi.plot_settings
  30.  
  31.  
  32. fig = plt.figure(figsize=(16,8))
  33.  
  34. ax1 = fig.add_subplot(1,2,1, projection=hmi)
  35. hmi.plot(axes=ax1)
  36. hmi.draw_grid()
  37.  
  38. ax2 = fig.add_subplot(1,2,2, projection=outmap)
  39.  
  40. outmap.plot(axes=ax2)
  41. ax2.coords.grid(color='k')
  42. plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement