@stevenleeds's original version used post-processing in python to create the integer (short) field which is operated on. This rescaling should be reintroduced in the wrapper interface
@stevenleeds's script:
# Pre-processor for MONC data for cloud tracking
# Adds a halo to the variables to process and outputs both the field and the mask as 16 bit integers
# Applies non-linear transformation to the vertical velocity field
# Can be used to test repeated MONC output
from numpy import *
from netCDF4 import Dataset
infile=Dataset('./BOMEX_data/BOMEX_CTRL21600s.nc','r',format='NETCDF4')
ncfile = Dataset('mask_field.nc','w',format='NETCDF4')
nrep=1
maskin=((infile.variables[('ql')][:]>1e-2)*(infile.variables[('w')][:]>0.0)).astype(int16)
maskin=tile(maskin,(nrep,nrep,1))
imax=shape(maskin)[0]+2 #include halo cells
jmax=shape(maskin)[1]+2 #include halo cells
kmax=shape(maskin)[2]
maskext=zeros((imax,jmax,kmax),short)
maskext[1:-1,1:-1,:]=maskin
del maskin
ncfile.createDimension('x',shape(maskext)[0])
ncfile.createDimension('y',shape(maskext)[1])
ncfile.createDimension('z',shape(maskext)[2])
print(shape(maskext))
data = ncfile.createVariable('maskext',dtype('short').char,('x','y','z'))
data[:] = maskext
del maskext
fieldin=(3200.0*sqrt(abs(infile.variables[('w')][:]))*(2*(infile.variables[('w')][:]>0.0)-1)).astype(int16)
fieldin=tile(fieldin,(nrep,nrep,1))
fieldext=zeros((imax,jmax,kmax),short)
fieldext[1:-1,1:-1,:]=fieldin
del fieldin
data = ncfile.createVariable('fieldext',dtype('short').char,('x','y','z'))
data[:] = fieldext
del fieldext
@stevenleeds's original version used post-processing in python to create the integer (short) field which is operated on. This rescaling should be reintroduced in the wrapper interface
@stevenleeds's script: