Apply a mask using another fieldΒΆ
in this case, use the land-sea mask field to mask non-land values
[1]:
%matplotlib inline
# for figures in notebook
# import & initialize epygram
import epygram
epygram.init_env()
import os
INPUTS_DIR = os.path.join('..', 'inputs')
[2]:
r = epygram.formats.resource(os.path.join(INPUTS_DIR, 'ICMSHAROM+0022'), 'r')
[3]:
f = r.readfield('SURFTEMPERATURE')
[4]:
fig, ax = f.cartoplot(subzone='CI')
[5]:
lsm = r.readfield('SURFIND.TERREMER')
[6]:
fig, ax = lsm.cartoplot(subzone='CI')
[7]:
import numpy
masked_data = numpy.ma.masked_where(lsm.getdata() < 0.5, f.getdata())
f.setdata(masked_data)
[8]:
f.cartoplot(subzone='CI')
[8]:
(<Figure size 1152x864 with 2 Axes>,
<GeoAxesSubplot:title={'center':'SURFTEMPERATURE\n2015-01-10 22:00:00'}>)
[ ]: