Example Scripts
Here are some example scripts. They introduce the basic and advance topics discussed in this HOWTO. They should be easily adaptable to your own uses. I tried to keep the scripts simple so that the focus would be on the ioapiTools packageq. An additional module that I recommend for providing key word arguments and command line control is optparse.
To use these scripts, simply download the files. make them executable (e.g. 'chmod u+x write_ioapi.py'), edit the setup section for your file paths, and run them. You can download the files as a tar file, demo_scripts.tar.gz, or individually:
- Reading a variable and writing a CF netCDF file
- Reading a variable and writing an IOAPI file
- Reading a variable across multiple files
- Spatially subsetting a variable
- Temporally subsetting a variable
- Vertically subsetting a variable
- Coordinate conversions
- Changing the start date of a variable
- Variable arithmetic and changing metadata
- Converting to cdms variables and Numeric arrays
- Advanced spatial subsetting
- Plotting
- Creating a daily average variable
- Masking a variable and creating new iovar variables