MapesCollection_doc
index
/home/suvarchal/Dropbox/MapesIDVCollection/mapescollection/MapesCollection_doc.py

 
Functions
       
MAE(gridA, gridB)
A function to calculate mean absolute error or difference between two grids
MSE(gridA, gridB)
A function to calculate mean square error or difference between two  grids
Moisture_Flux_Divergence(Q, V)
Computes vertical integrated Moisture flux divergence and makes 1 display internally 
and returns a moisture flux divergence vector as output.
this function takes a derived field vector as input.
anomalyFromTimeMeans(grid)
Computes deviation from time mean at each grid point.
areaWeights(grid)
Computes area weights of a grid and returns the grid with 
weights at each grid.
cdo(variable, user_cdo_options)
Does a cdo operation on grid supplied and returns a grid.
The function outsources the grid to CDOs (code.zmaw.de/cdo) user option decides what
operation can be done.
evalues in cdo as cdo user_cdo_options variable_written_to_temp_file.nc output_temp_file.nc
cdo2(variable1, variable2, user_cdo_options)
Does a cdo operation on 2 grids supplied and returns a grid.
The function outsources the two grids to CDOs (code.zmaw.de/cdo) user option decides what
operation can be done.
evalues in cdo as cdo user_cdo_options variable1_written_to_temp_file.nc variable2_written.nc output_temp_file.nc
cdoSubGrid(variable, user_nlon, user_nlat)
Computes a subgrid difference between a fine resolution and 
coarsened resolution grid (from regriding the 
original grid to user_nlon and user_nlat) using CDOs.Works
best for regular grids.
Note: Also needs ncatted from NCO's also to be on your path.
cdo_bandpass(variable, minday, maxday)
Do a band pass filter in time using CDOs and FFT. Before the filter
is applied data is detrended and feb 29, if exists will be deleted.
minday and maxday argument needs to be in units of days.
Note: Also needs ncatted from NCO's also to be on your path.
cdo_highpass(variable, minday)
Do a high pass filter in time using CDOs.Before the filter 
is applied data is detrended and feb 29, if exists will be deleted.
maxday argument needs to be in units of days.
Note: Also needs ncatted from NCO's also to be on your path.
cdo_lowpass(variable, maxday)
Do a low pass filter in time using CDOs.Before the filter 
is applied data is detrended and feb 29, if exists will be deleted.
maxday argument needs to be in units of days.
Note: Also needs ncatted from NCO's also to be on your path.
cdo_timecor(variable1, variable2)
Computes a correlation in time at each grid point using CDOs.
Note: Also needs ncatted from NCO's also to be on your path.
cdo_timecovar(variable1, variable2)
Computes a covariance in time at each grid point using CDOs.
Note: Also needs ncatted from NCO's also to be on your path.
computeGridAreaAverage(variable)
correlation(xvar, yvar)
Computes time correlation at each grid point in xvar with corresponding grid 
in yvar.
correlationwith1d(variable, variable1d)
Computes time correlation at each grid point with 1d variable supplied.
createNewUnit(field, unit, multiplyfactor=1.0)
creates a new unit that cannot be changed by IDV, eg..change units of 
precipitation from kg/m2s-1 to mm/day
createTimeMeans(grid, meanType='None')
Create time mean of a grid at periods specified by type.
meanType can be yearly, monthly, daily, hourly, minutes, seconds
ddt(grid, timegradunit)
compute tendency (time derivative) using forward difference, 
units of returned grid are units of grid per timegradient unit 
timegradient unit can be month, day, hour, minute, seconds
ddz(grid)
Computes a vertical coordinate derivative of grid specifed.
deviationXY(grid)
Computes deviation from grid grid area average value of a grid
and returns a grid with deviation from the area averaged value.
deviationXYT(grid)
Computes deviation from time and spatial mean at each grid point.
fillGridConstant(templategrid, user_value)
Returns a grid with a constant value
More of a helper function useful for debugging
fillGridNormal(templategrid, user_mean, user_std, user_units='default')
Returns a grid with values sampled from normal distrubuition(
user_mean,user_std). user_units can be change units of returned grid. 
This also serves as a template code for creating grids sampled from 
different distributions.
fillGridUniform(templategrid, user_min, user_max, user_units='default')
Returns a grid with values sampled from uniform distrubuition(
user_min,user_max). user_units can be change units of returned grid. 
This also serves as a template code for creating grids sampled from 
different distributions.
getAbsCDiff(levels)
getLevels(grid)
A helper function to get levels values inside a grid as a list.
getRawTimes(grid)
A helper function to get all times inside a grid, returns a list of times
getSampleTimeIndices(grid, year=None, season=None, mon=None, day=None, hour=None, min=None, sec=None, ms=None)
A Helper function to get indices a grid at specified time periods, multiple arguments can be used in 
complex sampling. This function returns list of indices in grid.
getSampleTimesInFormat(grid, timeformat, timezone='UTC', outformat='string')
A Helper function to return times of a grid in specified format as a list.
getSamplesAtTimes(grid, year=None, season=None, mon=None, day=None, hour=None, min=None, sec=None, ms=None)
Samples a grid at specified time periods, multiple arguments can be used in complex sampling 
eg.., using hour = 5 would return all samples corresponding  to 5 am, further specifing year = 2008 
would give samples at 5am in year 2008
getSimilarInd(inparray, value)
A helper function to get all indices of an array where it matches given value
getTimeDict(grid)
A helper function to return timestamps of grid as dictionary of years, months etc.
getVarName(grid)
A helper function to get raw variable name in side a grid
isEnsembleGrid(grid)
A helper function to check if grid is ensemble type or not
Checks both (time,ensemble) and(ensemble...) grids
makeTimeComposite(variable, avgvariable, minvalue, maxvalue)
Make a time composite of grid supplied(variable) between min max ranges 
of a 1d avg variable supplied.
makeTimeCompositeWindow(avgvariable, variable, minvalue, maxvalue, minwindow, maxwindow)
Make a time composite of grid supplied(variable) between min max ranges and time windows
of a 1d avg variable supplied.
pverticalIntegral(grid)
Computes a vertical coordinate integral of a 3D grid/gravity
integral( grid dp/g)
rebin(grid, newGrid)
Rebin or regrid a grid based on coordinates of newGrid using bilinear 
interpolation
remove_duplicates(values)
A helper function to remove dumplicates, from a list, not necessary
easier to change list to a set and backwards.
returnMatches(a, b)
A helper function to to return all indices of list a that have matches in list b.
sampleAtTimesofGridB(gridA, gridB, matchformat='yyyyMMddhhmm')
A function to programatically sample gridA at times of gridB, similar to idv gui but the format
decides what type type is picked.
one other application of this utility is when there are a lot of times where gui selection in
IDV becomes tedious.
setValuestoGridAverage(variable, avgvariable)
Set all values at each grid in a grid by spatial average,
currently the average is not area weighted
subsetGridTimes(gridA, gridB)
A function to subset gridA by times of gridB.
duplicate of another function subsetAtTimesofB
verticalIntegral(grid)
Computes a vertical coordinate integral of a 3D grid.
verticalWeightedAvg(grid)
Computes a vertical coordinate weighted average of a 3D grid.
verticalsmooth(grid)
Smooth a grid at all vertical levels using 9 point smoother
xyAreaAverage(grid)
Computes Area Average of a grid and returns a grid with area 
averaged value at all grid points.
zonal_filter_fft(grid, minwave, maxwave)
Filters grid by zonal wavenumbers specified by minwave and maxwave.
maxwave can be a large number to filter all smaller wavenumbers.
for eg.., using minwave =1,10000, removes all variations zonally but mean
using minwave=0 maxwave=0 removes zonal mean from the grid.