Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
title: Getting Started with CDAT layout: default
Welcome to CDAT!
To run the examples, you first have to use the unix
source command to load the CDAT environment.
conda activate [YOUR_CDAT_CONDA_ENV]
On older anaconda version it might be
source activate [YOUR_CDAT_CONDA_ENV]
Once you've loaded the environment, you should be able to run the examples. They should output a .png file that has the same image as the example.
We strongly recommend using Jupyter notebook for the tutotrials
We also recommend using the interactive python console for figuring out how to use CDAT's scripting capabilities.
To run the interactive console, use the
ipython command, which should give you something like this:
Python 2.7.14 | packaged by conda-forge | (default, Dec 25 2017, 01:18:54) Type "copyright", "credits" or "license" for more information. IPython 5.5.0 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. In :
To learn more about
ipython, you can read this tutorial.
Here's a very simple example that walks you through the most basic steps:
import vcs, cdms2, cdat_info # Download sample data files vcs.download_sample_data_files() # The vcs_canvas is the root object of VCS vcs_canvas = vcs.init() cdms_file = cdms2.open(vcs.prefix + "/sample_data/clt.nc") # We'll pull a variable out of the netCDF file clt_variable = cdms_file("clt") # And then we'll plot it using the default graphics method (a boxfill) and the default template. vcs_canvas.plot(clt_variable) # To output to a .png file, you can just do this: vcs_canvas.png("clt.png") # And that's it!
Hopefully that helps some! If you have any other questions, let us know!