IDL Library

Introduction

The page describes the library of IDL (Interactive Data Language) routines I've written that I'm making publically available. Although I've used these routines in my own research, I cannot guarantee that they will work for your purposes. More disclaimers and other fine print is below.

If you email me your email address, however, I'll let you know of any major bugs that are found in this library. Most of the routines on this page have not been developed/maintained since the first decade of the 2000s. They are published for historical and educational purposes only. I would not recommend you to use them for your own work as is.

The page is subdivided into these categories:

General documents about the routines in the library:

Unix tar files of the routines below:

  • all_idl.tar: All (except for the QTCM Tools) of my routines, plus copies of required "user-written" (i.e. not built-in with the IDL distribution) dependencies that I haven't written.
  • jwl_idl.tar: Only all (except for the QTCM Tools) the routines written/modified by me.

ARCSyM Tools

These routines are designed for use with the ARCSyM regional Arctic climate model. However, they are probably general enough to use with other atmospheric sciences applications; just pay attention to the commenting in the code. The routines that are the best candidates for being "general enough" are in green.

  • BUOY_FREQ_SQD: Calculates the square of the buoyancy frequency (a.k.a. square of the Brunt-Vaisala frequency), for near the earth's surface (e.g. the troposphere). NB: I found a major bug on 2 Mar 2004 in this code. Results obtained with any version of the code prior to this day are entirely incorrect. Accordingly I've removed the code from public distribution. Please feel free to email me about details.

[Back up top to the Introduction.]

Atmospheric Sciences

See also the section "CCM3 Tools" for additional atmospheric sciences routines that are designed for use with output from the CCM3 GCM.

  • CYCLONE_LOC: Given a 2-D longitude-latitude grid (of arbitary grid spacing) of sea level pressure, function returns the spatial locations of all cyclones in the domain, using the detection method of Serreze (1995) and Serreze et al. (1997). Files required:
  • CYCLONE_TRACKS: Given a timeseries of 2-D longitude-latitude grids (of arbritrary grid spacing) of sea level pressure, function returns a structure that describes where every cyclone in the timeseries is located in space, at every moment in the timeseries, using the detection and tracking method of Serreze (1995) and Serreze et al. (1997). Files required: Unix tar file of above routines: cyclone_tracks_idl.tar.
    Notices and additional documentation:
  • DISTANCE: Given two points on the surface of a sphere (e.g. the earth), given by longitude and latitude pairs, computes the linear distance along the surface of the sphere between the two points. File required:
  • LC_LAGCORR: Calculate one or several lag correlation maps. The map is the correlation of each point in a timeseries of 2-D slices with a single point timeseries. Signficance is calculated using one-tail t-test, with a measure of effective degree of freedom (EDOF) from Livezey & Chen (1983) and Chen (1982). File required: Notices and additional documentation:
  • NN_INTERP: Returns the near-neighbor interpolation for a regular or irregular grid, located on the surface of the earth. Files required: Notices and additional documentation:
    • Notes regarding use of the function: Last updated 3 Jul 2001.
  • REDUCE_TO_SLP: Given a value of air pressure, air temperature, and water vapor mixing ratio, at a given elevation, returns the air pressure reduced to sea level pressure. File required:

[Back up top to the Introduction.]

CCM3 Tools

These routines are designed for use with the NCAR CCM3 atmospheric general circulation model. However, some are probably general enough to use with other atmospheric sciences applications; just pay attention to the commenting in the code. The routines that are the best candidates for being "general enough" are in green.

  • CALCANOM: Calculates the anomalies of a hyperslab of data (dimensioned [lon,lat,time]) as the deviation from a spline-fit to monthly climatology. NB: I found a major bug on 19 Sep 2001 in this code. Results obtained with any version of the code prior to this day are entirely incorrect. Other routines that have CALCANOM as a dependency also will return incorrect results. See notice below. Files required: Notices and additional documentation:
  • CALCCLIM: Calculates the monthly climatology of a hyperslab of data (dimensioned [lon,lat,time]). File required: Notices and additional documentation:
    • Notes regarding use of the function: Last updated 24 Aug 2001.
  • CLIMVAR_DATA: For each point in X-Y space, compute the variance of the time series of the grid, using spline fit climatology as the "mean" of the time series. Files required: Notices and additional documentation:
  • Q1Q2_Y73: Calculate apparent heat source and moisture sink, after Yanai et al. (1973). Files required:

[Back up top to the Introduction.]

Date and Time

  • JULDAY_TO_DYR365: Given the Julian day, returns the day in the year (e.g. Jan 1st is day 1, Jan 2nd is day 2, etc.), assuming a 365 day year. Leap days are set to day -999. File required:
  • JULDAY_TO_YMDH: Given the Julian day, returns the Year/Month/Day/Hour as a long integer. This integer can be expressed as either 4-digit year (yyyymmddhh, which is the default) or 2-digit year (yymmddhh). Note: This function is not an exact inverse of YMDH_TO_JULDAY (see code top comment block for details). Notices and additional documentation:
  • YMDH_TO_JULDAY: Given Year/Month/Day/Hour long integer (expressed as 4-digit year yyyymmddhh) convert to Julian Day. Note: This function is not an exact inverse of JULDAY_TO_YMDH (see code top comment block for details).

[Back up top to the Introduction.]

File Management

  • DUPLICATE_PRO: Searches all directories in system variable !PATH to find whether there are duplicates of any of the *.pro files in those directories. Returns a vector of all filenames of which there are more than one version. Currently only works for Unix, though extending it to other OS families should be simple. File required: Notices and additional documentation:

[Back up top to the Introduction.]

General

  • ALL_VARS_TO_STRUCT: Creates a structure containing all the variables that are defined in the calling level (i.e. the level one up from this function) at the time ALL_VARS_TO_STRUCT is called. File required: Notices and additional documentation:

[Back up top to the Introduction.]

Mathematics

  • COMPLEXITY_1: Calculate the first-order complexity, as defined by Elsner and Tsonis (1993), for finite word length n. Files required: Unix tar file of above routines: complexity_1_idl.tar
    Notices and additional documentation:
  • COMPLEXITY_2: Calculate the second-order complexity, as defined by Elsner and Tsonis (1993), for finite word length n. Files required: Unix tar file of above routines: complexity_2_idl.tar
    Notices and additional documentation:
  • LAMBDA_LOG_DISP: Calculate the time-dependent exponent (lambda) and logarithmic displacement curves, as defined by Gao (1997), by calling an executable version of the Fortran 90 routine LAMBDA_LOG_DISP. File required: Notices and additional documentation: A detailed discussion of how to generate the needed executable is given in the "Notes" above.
  • LANCZOS_BANDPASS: Bandpass filters a timeseries using a Lanczos smoothed symmetric non-recursive Fourier method filter. File required: Notices and additional documentation:
  • PCOMP_K67: Principal component analysis using the method of Kutzbach (1967). This method is based on finding the eigenvector and eigenvalues of the covariance matrix of the input data. File required:
  • PROMAX_HW64: Given an input array of factor loadings (empirical orthogonal functions, i.e. EOFs), rotate the factors using a method almost identical to the Promax method of Hendrickson and White (1964). Files required:
  • RPCA_LA00: Obliquely rotated principal component analysis (PCA) using a revised Promax method, similar to that of Lin and Arakawa (2000). Files required:
  • SCALE_LYAPUNOV: Calculate the scale-dependent Lyapunov exponent as defined by Hwang et al. (2000) given values of the time-dependent exponent (which can be calculated by LAMBDA_LOG_DISP). File required: Notices and additional documentation:
  • VARIMAX_K58: Given an input array of factor loadings (empirical orthogonal functions), rotate the factors using the Varimax criteria of Kaiser (1958, 1959). File required: Notices and additional documentation:
  • WTD_MEAN: Returns the weighted mean of an array of values. File required:
  • YMDH_MEAN: Given a set of timeseries and a corresponding vector of Year/Month/Day/Hour long integer (expressed as 4-digit year yyyymmddhh) giving the time coordinates of each element in the timeseries, calculates a "staggered" running mean (in contrast with SMOOTH which calculates a non-staggered running mean), e.g. a 24-hour average is computed every 24 hours. Input array may contain NaN values.

[Back up top to the Introduction.]

QTCM Tools

These tools are designed for use with output from the Neelin-Zeng QTCM (v2.1) tropical atmosphere model. The code (main program and supporting subroutines) in these tools are rougher than anything else described on this libraries web page, and I do not recommend they be used outside of the specific tool in which they are found; thus these tools are not included in the Unix tar files that contain the rest of this library. Additionally, I do not know if the tool will work on an OS besides Unix. Do not put these files into your IDL default path. The code for these tools have a separate license and disclaimer which are found in the file README that is included in the tool tar file. Detailed notes regarding the tool are also in the README file.

  • FFT_TOOL: Program to calculate wavenumber-frequency spectral power of a QTCM outputted field. File required: Notices and additional documentation:
  • VAR_FIELD: Program to calculate variance of a QTCM outputted field at each point in space. File required: Notices and additional documentation:
  • WK_TOOL: Program to calculate and plot Wheeler and Kiladis (1999, Fig. 3b) type plots of the ratio of OLR power to background power of a QTCM outputted field. File required:

[Back up top to the Introduction.]

Copyright and Licensing

Unless otherwise stated, the IDL routines described on this page or which reference this page are copyright © 2000-2002 by Johnny Lin and constitute a library that is covered under the GNU Lesser General Public License (LGPL):

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.

You can contact Johnny Lin by email or at this address.

A copy of the GNU LGPL can be found here. In the Unix tar files, an ASCII text copy of the GNU LGPL is also provided, the file GNU_LGPL.txt. Please note that these disclaimers of warranty supercede any implied or explicit warranties or claims found in the text of the routine source code themselves.

[Back up top to the Introduction.]

Acknowledgements: Some of the routine(s) listed on this page are based, at least in part, upon work supported by the National Science Foundation under grant number OPP-0129800. Any opinions, findings and conclusions or recommendations expressed in this material are those of the author and do not necessarily reflect the views of the NSF.

Return to the Libraries Index.
Return to Johnny Lin's Home Page.

Creative Commons License Updated: Tuesday, 16-Jul-2019 08:25:38 PDT. Disclaimer. Privacy Policy. Valid CSS, HTML.
Author: Johnny Lin <email address>. This library description page is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License.