Spatial NetCDF variable (corresponding to a 2D or 3D scalar field). More...
#include <NCSpatialVariable.hh>

Public Member Functions | |
| NCSpatialVariable () | |
| virtual void | init (string name, IceGrid &g, GridType d) |
| virtual PetscErrorCode | read (const char filename[], unsigned int time, Vec v) |
| Read a variable from a file into a global Vec v. | |
| virtual PetscErrorCode | reset () |
| Reset all the attributes. | |
| virtual PetscErrorCode | write (const char filename[], nc_type nctype, bool write_in_glaciological_units, Vec v) |
Write a global Vec v to a variable. | |
| virtual PetscErrorCode | regrid (const char filename[], LocalInterpCtx &lic, bool critical, bool set_default_value, PetscScalar default_value, MaskInterp *, Vec v) |
Regrid from a NetCDF file into a global Vec v. | |
| virtual PetscErrorCode | to_glaciological_units (Vec v) |
Converts v from internal to glaciological units. | |
Public Attributes | |
| bool | time_independent |
Protected Member Functions | |
| PetscErrorCode | define (int ncid, nc_type nctype, int &varid) |
| Define a NetCDF variable corresponding to a NCVariable object. | |
| PetscErrorCode | report_range (Vec v, bool found_by_standard_name) |
Report the range of a global Vec v. | |
| PetscErrorCode | change_units (Vec v, utUnit *from, utUnit *to) |
Converts v from the units corresponding to from to the ones corresponding to to. | |
| PetscErrorCode | check_range (Vec v) |
Check if the range of a global Vec v is in the range specified by valid_min and valid_max attributes. | |
Protected Attributes | |
| GridType | dims |
| IceGrid * | grid |
Spatial NetCDF variable (corresponding to a 2D or 3D scalar field).
Definition at line 9 of file NCSpatialVariable.hh.
Definition at line 94 of file NCVariable.cc.
| PetscErrorCode change_units | ( | Vec | v, | |
| utUnit * | from, | |||
| utUnit * | to | |||
| ) | [protected] |
Converts v from the units corresponding to from to the ones corresponding to to.
Does nothing if this transformation is trivial.
Definition at line 374 of file NCVariable.cc.
References NCVariable.com, e, and NCVariable.short_name.
Referenced by read(), regrid(), to_glaciological_units(), and write().
| PetscErrorCode check_range | ( | Vec | v | ) | [protected] |
Check if the range of a global Vec v is in the range specified by valid_min and valid_max attributes.
Definition at line 567 of file NCVariable.cc.
References NCVariable.com, grid, NCVariable.has(), NCVariable.short_name, NCVariable.strings, fill_missing.valid_max, fill_missing.valid_min, and verbPrintf().
Referenced by regrid().
| PetscErrorCode define | ( | int | ncid, | |
| nc_type | nctype, | |||
| int & | varid | |||
| ) | [protected] |
Define a NetCDF variable corresponding to a NCVariable object.
Definition at line 607 of file NCVariable.cc.
References check_err(), NCVariable.com, dims, grid, GRID_2D, GRID_3D, GRID_3D_BEDROCK, NCVariable.rank, NCVariable.short_name, and time_independent.
Referenced by write().
Definition at line 99 of file NCVariable.cc.
References IceGrid.com, dims, grid, IceGrid.rank, and NCVariable.short_name.
| PetscErrorCode read | ( | const char | filename[], | |
| unsigned int | time, | |||
| Vec | v | |||
| ) | [virtual] |
Read a variable from a file into a global Vec v.
This also converts the data from input units to internal units if needed.
Definition at line 109 of file NCVariable.cc.
References change_units(), NCTool.close(), NCVariable.com, IceGrid.da2, dims, NCTool.find_variable(), NCTool.get_units(), PISMIO.get_var(), grid, NCVariable.has(), vnreport.nc, NCTool.open_for_reading(), NCVariable.short_name, NCVariable.strings, NCVariable.units, and verbPrintf().
| PetscErrorCode regrid | ( | const char | filename[], | |
| LocalInterpCtx & | lic, | |||
| bool | critical, | |||
| bool | set_default_value, | |||
| PetscScalar | default_value, | |||
| MaskInterp * | interpolation_mask, | |||
| Vec | v | |||
| ) | [virtual] |
Regrid from a NetCDF file into a global Vec v.
v to default_value if set_default_value == true and the variable was not found Definition at line 213 of file NCVariable.cc.
References change_units(), check_range(), NCTool.close(), NCVariable.com, IceGrid.da2, dims, NCTool.find_variable(), NCTool.get_units(), NCVariable.glaciological_units, grid, NCVariable.has(), vnreport.nc, NCTool.open_for_reading(), NCVariable.read_valid_range(), PISMIO.regrid_var(), report_range(), LocalInterpCtx.report_range, PISMIO.set_MaskInterp(), NCVariable.short_name, NCVariable.strings, NCVariable.units, and verbPrintf().
| PetscErrorCode report_range | ( | Vec | v, | |
| bool | found_by_standard_name | |||
| ) | [protected] |
Report the range of a global Vec v.
Definition at line 523 of file NCVariable.cc.
References NCVariable.com, NCVariable.glaciological_units, NCVariable.has(), NCVariable.short_name, NCVariable.strings, NCVariable.units, and verbPrintf().
Referenced by regrid().
| PetscErrorCode reset | ( | ) | [virtual] |
Reset all the attributes.
Reimplemented from NCVariable.
Definition at line 85 of file NCVariable.cc.
References NCVariable.strings, and time_independent.
Referenced by NCSpatialVariable().
| PetscErrorCode to_glaciological_units | ( | Vec | v | ) | [virtual] |
Converts v from internal to glaciological units.
Definition at line 366 of file NCVariable.cc.
References change_units(), NCVariable.glaciological_units, and NCVariable.units.
| PetscErrorCode write | ( | const char | filename[], | |
| nc_type | nctype, | |||
| bool | write_in_glaciological_units, | |||
| Vec | v | |||
| ) | [virtual] |
Write a global Vec v to a variable.
Defines a variable and converts the units if needed.
Definition at line 167 of file NCVariable.cc.
References change_units(), NCTool.close(), define(), dims, NCTool.find_variable(), NCTool.get_ncid(), NCVariable.glaciological_units, grid, vnreport.nc, PISMIO.open_for_writing(), PISMIO.put_var(), NCVariable.short_name, NCVariable.strings, NCVariable.units, and NCVariable.write_attributes().
Definition at line 24 of file NCSpatialVariable.hh.
Referenced by check_range(), define(), init(), NCSpatialVariable(), read(), regrid(), and write().
| bool time_independent |
Definition at line 21 of file NCSpatialVariable.hh.
1.6.2-20100124