Updated: 2019/11/13
%load_ext ferretmagic
%%ferret
set text/font=hershey
use coads_climatology
shade sst[l=10] ; go land
! Enter_GO land ! Exit_GO
%ferret_getdata sstdict = sst
Message: sstdict is now available in python as a dictionary containing the variable's metadata and data array.
sstdict.keys()
dict_keys(['title', 'data', 'missing_value', 'data_unit', 'axis_types', 'axis_names', 'axis_units', 'axis_coords'])
sstdata = sstdict['data']
type(sstdata)
numpy.ndarray
import numpy
mask = numpy.abs(sstdata - sstdict['missing_value']) < 1.0E-5
sstdata[mask] = -10.0
sstdict['name'] = 'SSTCopy'
sstdict['title'] = 'SST with miss vals set to -10'
sstdict.keys()
dict_keys(['title', 'data', 'missing_value', 'data_unit', 'axis_types', 'axis_names', 'axis_units', 'axis_coords', 'name'])
%ferret_putdata sstdict
Message: sstdict is now available in ferret as SSTCopy
%%ferret
show data
shade sstcopy[l=1]
currently SET data sets: 1> /opt/ferret_dsets/data/coads_climatology.cdf (default) name title I J K L SST SEA SURFACE TEMPERATURE 1:180 1:90 ... 1:12 AIRT AIR TEMPERATURE 1:180 1:90 ... 1:12 SPEH SPECIFIC HUMIDITY 1:180 1:90 ... 1:12 WSPD WIND SPEED 1:180 1:90 ... 1:12 UWND ZONAL WIND 1:180 1:90 ... 1:12 VWND MERIDIONAL WIND 1:180 1:90 ... 1:12 SLP SEA LEVEL PRESSURE 1:180 1:90 ... 1:12 ------ Python Variables ------ SSTCOPY SST with miss vals set to -10 1:180 1:90 ... 1:12 ... ...