cmap=plt.cm.viridis.copy()# or any other colormap, e.g., 'RdBu_r'cmap.set_bad(color='lightgray')fig,ax=plt.subplots()(ds['Cr']).where(grd.tmask.rename({'nx':'LON','ny':'LAT'})==1).plot(ax=ax,cmap=cmap,vmax=1)
<matplotlib.collections.QuadMesh at 0x14c73e85f850>
# Global attrsds.attrs['long_name']='MLE Cr mask (0 in the Lab Sea and 1 elsewhere)'ds.attrs['units']='nondim'ds.attrs['author']='Gustavo Marques (gmarques@ucar.edu)'ds.attrs['date']=datetime.now().isoformat()ds.attrs['url']='https://github.com/NCAR/tx2_3/mle_frontal_length_scale/'ds['LON'].encoding['_FillValue']=Noneds['LAT'].encoding['_FillValue']=Noneds['LAT'].attrs['units']='degrees_north'ds['LAT'].attrs['axis']='Y'ds['LON'].attrs['units']='degrees_east'ds['LON'].attrs['axis']='X'
fname='mle_cr_labsea_mask_tx2_3v3_{}.nc'.format(today)# Save fileds.to_netcdf(fname,engine="netcdf4",format="NETCDF3_64BIT_DATA")# Close the datasetds.close()