Blog

Learning by doing.


Extreamly Useful NCL Tricks

May 18, 2015 • NCL • Tags: NCL Bash

Introduction

NCL is a tool for scientific (specifically, atmospheric and oceanic, or geophsical) data analysis and visulization. It can produce high quality and beautiful plots easily.

In this post, I will introduce some extreamly useful NCL tricks I used in my daily work.

Loop variables of a NCL script in one command line. [2015-05-18]

In our daily work, it is quite normal that we need to write a NCL script to finish a job. Sometimes it is not quite easy to loop certain variables in the script because NCL cannot support automatical overwriting the variables (e.g., when the dimension has been changed). However, NCL does support system interactions. With this function, we can loop our variable easily in the shell like this:

for i in {1..5}; do ncl var=$i script.ncl; done

Note that the declaration of the var in the script should be omitted.

If you need to loop more than one variables, just nest your for loop in your command line.

Tags: NCL Bash