Opened 16 years ago
Closed 16 years ago
#141 closed enhancement (fixed)
Writing added variables
Reported by: | Huw Lewis | Owned by: | Huw Lewis |
---|---|---|---|
Priority: | normal | Milestone: | 2.0 |
Component: | ropp_io | Version: | 1.1 |
Keywords: | Cc: |
Description
The means to write all additional variables in an input file to the output file, so any user-defined variables are preserved on further read/write.
Change history (3)
comment:1 by , 16 years ago
Milestone: | 2.0 |
---|
comment:2 by , 16 years ago
Milestone: | → 2.0 |
---|
comment:3 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
See changeset [1797]. These updates now ensure a netCDF file with any number of additional variables (scalar 0-d, 1-d or 2-d data types) in read in and subsequently written out along with the anticipated variables defined by the ROPP interface file format.
Enhancements to the functionality of ropp_io_read_ncdf_get to enable undefined variables (i.e. not explicitly read using ncdf_getvar call) to be read from an input file, and written out again. i.e. additional variables are preserved on subsequent read/write.
Method:
- In ncdf_open the opened file is checked for the number of variables it contains, and this is saved to a ncdf module variable ncdf_nvars.
- The ncdf module has a new public variable ncdf_read. This is an array of logical statements, set to true in ncdf_getvar for each variable which is read.
- After all explicitly defined variables are read in ropp_io_read_ncdf_get, the ncdf_read variable is checked for each of the ncdf_nvars available variables. For those variables in the input file not yet read, a routine ropp_io_read_ncdf_get_vlistD#d is called, depending on the dimension of the variable to be read in.
- The vlist read routines (in file ropp_io_vlist_read) allocate an element of the Vlist data types in the ROprof structure, depending on the dimensions of the variable to be read. The variable name is found by doing a variable inquiry. Given the name and allocated variable structure, the additional data are read with a call to ncdf_getvar as before.
- Note udunits has been modified to allow output units to be set to input units if the output units are not previously set (e.g. for reading additional variables).
- Added variables are written out as before in ropp_io_write_ncdf_def and ropp_io_write_ncdf_put routines.
Note that it is not envisaged that ROPP will provide functionality to process additional variables - given we can't be expected to know what type of variables may be included. A simple addition to rangechecking procedures may be added however - I will write a new ticket to cover this idea.
ropp2ropp has been successfully tested using additional 1d and 2d data arrays, and cases with more than 1 added variable in a file.
Milestone 2.0 deleted