metrics.filehandler
Simple class to load and save NetCDF-Files
filehandler Module
-
class metrics.filehandler.FileHandler[source]
Simple static class to read and write netcdf files unsing scipy.io.netcdf
-
static createDimension(f, value, name, var_type='double')
Create a dimension in netcdf file f
Parameters: |
- f – open netcdf file
- value – array or list with dimenstion data
- name – name of dimension
- var_type – type of dimenstion (double, float, ...)
|
-
static _copyNetCDF(fn, new_fn, field)
Copies a given netcdf file using scipy.io
Also stores a new field in the netcdf file
Parameters: |
- fn – filename of netcdf to copy
- new_fn – new filename
- field – Array with new values for result file
|
-
static saveToNetCDF(field, refFile, tag)[source]
Saves a numpy array to an netCDF file.
Parameters: |
- field – numpy array
- refFile – File to “clone”
- tag – new filename
|
:return filepath
-
static getVariableValue(var)
Get values of a variable using scipy.io
Parameters: | var – netcdf.variable |
-
static openNetCDFFile(fn, mode='all')[source]
Open a file as numpy array
Either get a dict with “var”,”lon”,”lat” or only “var”
New Option mode=’plev’ gives also pressure levels