malena
malena

Reputation: 1

Mask over the tropic in Healpix

I have my data in Healpix grid, I'm trying to apply a mask over the tropic as follow:

NSIDE = hp.get_nside(EP)  
npix = hp.nside2npix(NSIDE)  
theta, phi = hp.pix2ang(NSIDE, np.arange(npix))  
theta_min = (2*np.pi/3)  
theta_max = (np.pi/3)  
tropical_mask = (theta <= theta_min)&(theta >= theta_max)

The resulting mask is: mask over the tropic

However, when I apply the mask to my variable as:

EP_tropic= EP.where(tropical_mask)

This is what I get: no masking the tropic

No really masking the tropic.

The worldmap function is defined as:

def worldmap(var, **kwargs):   
     projection = ccrs.Robinson(central_longitude=-135.5808361)
     fig, ax = plt.subplots(figsize=(8, 4),
     subplot_kw="projection":projection},constrained_layout=True)   
     ax.set_global()
     image= egh.healpix_show(var, ax=ax, **kwargs)  
     ax.add_feature(cf.COASTLINE, linewidth=0.8)    
     ax.add_feature(cf.BORDERS, linewidth=0.4)     
     return fig, ax, image

I tried to apply the mask as:

EP_tropic=hp.ma(EP)  
EP_tropic.tropical_mask= np.logical_not(tropical_mask)

and changing the projection for cartopy (no success).

Upvotes: 0

Views: 22

Answers (0)

Related Questions