IDL (Interactive Data Language) is a widely used general purpose on scientific data analysis and visualization package. With IDL, one can handle huge amound of datasets, create various graphs, and visualize 2 and 3-D data using plots, contours, iso-surfaces and slices. Also, IDL has image processing capabilities such as smoothing, sharpening and thresholding. For the begining of the user's first step, lots of IDL tutorials are found from IDL expert's webpages. I'd like to introduces some helpful links to IDL beginner.
1. Complete list of Frequently Asked Questions about the IDL is shown in JHU IDL web page.
This site provides useful answers about IDL related 'what' and 'how' problems.
2. Basic tutorials by Hugh Pumphrey's "an introduction of IDL" note.
3. Well documented and illustrated online IDL tutorial by UMN supercomputing institute is appropriated to the beginner.
4. A good starting point to using IDL is the guide written by NCAS-CMS - 'An Introduction to Using IDL in Meteorology
...More will be added
Showing posts with label IDL. Show all posts
Showing posts with label IDL. Show all posts
Wednesday, October 15, 2008
Monday, October 13, 2008
[SubRT] Sun Position
To calculate sun position, which is important to calculate radiative trasfer, zensun.pro calculates
solar position information as a function of geographic coordinates, date and time.
Calculated solar zenith angle at mid latitude region (lat=35N, lon=130E) as a function of hour (UTC) on Jan 1 (solid line) and Jun 20 (dashed line), respectively.
[Function] Plot Symbol
IDL's default symbols are not enough to represent express geo-data information.
Plotsym.pro which is contained in IDL ASTRO Library is useful in this sense.
Below figure is an example of plotsym, stars and circle can be generated from calling of plotsym.
Plotsym.pro which is contained in IDL ASTRO Library is useful in this sense.
Below figure is an example of plotsym, stars and circle can be generated from calling of plotsym.
[SubRT] GSHHS, High Resolution Shoreline Database
Subroutine: GSHHS_PLOT.pro by Liam Gumley's IDL web page.
Data : NOAA National Geophysical Data Center(NGDC)
High resolution map provided in IDL sometimes dose not looks so high enough.
NOAA/NGDC's Global Self-consistent, Hierarchical, High-resolution Shoreline (GSHHS) database from high resolution satellite observation show perfect for mapping of local scale data mapping. Look at the following figures comparing (left) shoreline from IDL's default map and (right) that from GSHHS. Advantage of GSHHS is that it can fill islands but IDL's cannot.

(Figure from IDL Korean user's group)
For use of GSHHS,
Data : NOAA National Geophysical Data Center(NGDC)
High resolution map provided in IDL sometimes dose not looks so high enough.
NOAA/NGDC's Global Self-consistent, Hierarchical, High-resolution Shoreline (GSHHS) database from high resolution satellite observation show perfect for mapping of local scale data mapping. Look at the following figures comparing (left) shoreline from IDL's default map and (right) that from GSHHS. Advantage of GSHHS is that it can fill islands but IDL's cannot.
(Figure from IDL Korean user's group)
For use of GSHHS,
1. download GSHHS database files from NOAA/NGDC or Liam's web and extract them.
gshhs_f.b : Full Resolution, gshhs_h.b : High Resolution, gshhs_i.b : Intermediate Resolution (simmilar to IDL's high resolution map) gshhs_l.b : Low Resolution(simmilar to IDL's low resolution map)
2. copy them to IDL's library folder.
Reference; Wessel, P., and W. H. F. Smith (1996), A Global Self-consistent, Hierarchical, High-resolution Shoreline Database, J. Geophys. Res., 101, 8741-8743.
[SubRT] Converts Gregorian dates to Julian days
PRO G2JDAY, YR, MN, DAY, HR, JULIAN
; NAME: G2JDAY
; PURPOSE: Converts Gregorian dates to Julian days
; CALLING SEQUENCE: JDCNV, YR, MN, DAY, HR, JULIAN
;
; INPUTS: YR = Year (integer); MN = Month (integer 1-12); DAY = Day (integer 1-31);
; HR = Hours and fractions of hours of universal time (U.T.)
; OUTPUTS: JULIAN = Julian date (double precision)
; EXAMPLE: To find the Julian Date at 1978 January 1, 0h (U.T.)
; IDL> JDCNV, 1978, 1, 1, 0., JULIAN
; will give JULIAN = 2443509.5
; NOTES:
; REVISON HISTORY:; Converted to IDL from Don Yeomans Comet Ephemeris Generator,
; B. Pfarr, STX, 6/15/88; Converted to IDL V5.0 W. Landsman September 1997
On_error,2
if N_params() LT 5 then begin
print,'Syntax - JDCNV, yr, mn, day, hr, julian
print,' yr - Input Year (e.g. 1978), scalar or vector
print,' mn - Input Month (1-12), scalar or vector
print,' day - Input Day (1-31), scalar or vector
print,' hr - Input Hour (0-24), scalar or vector
print,' julian - output Julian date'
return
endif
yr = long(yr) & mn = long(mn) & day = long(day) ;Make sure integral
L = (mn-14)/12 ;In leap years, -1 for Jan, Feb, else 0
julian = day - 32075l + 1461l*(yr+4800l+L)/4 + $
367l*(mn - 2-L*12)/12 - 3*((yr+4900l+L)/100)/4
julian = double(julian) + (HR/24.0D) - 0.5D
return
end
; NAME: G2JDAY
; PURPOSE: Converts Gregorian dates to Julian days
; CALLING SEQUENCE: JDCNV, YR, MN, DAY, HR, JULIAN
;
; INPUTS: YR = Year (integer); MN = Month (integer 1-12); DAY = Day (integer 1-31);
; HR = Hours and fractions of hours of universal time (U.T.)
; OUTPUTS: JULIAN = Julian date (double precision)
; EXAMPLE: To find the Julian Date at 1978 January 1, 0h (U.T.)
; IDL> JDCNV, 1978, 1, 1, 0., JULIAN
; will give JULIAN = 2443509.5
; NOTES:
; REVISON HISTORY:; Converted to IDL from Don Yeomans Comet Ephemeris Generator,
; B. Pfarr, STX, 6/15/88; Converted to IDL V5.0 W. Landsman September 1997
On_error,2
if N_params() LT 5 then begin
print,'Syntax - JDCNV, yr, mn, day, hr, julian
print,' yr - Input Year (e.g. 1978), scalar or vector
print,' mn - Input Month (1-12), scalar or vector
print,' day - Input Day (1-31), scalar or vector
print,' hr - Input Hour (0-24), scalar or vector
print,' julian - output Julian date'
return
endif
yr = long(yr) & mn = long(mn) & day = long(day) ;Make sure integral
L = (mn-14)/12 ;In leap years, -1 for Jan, Feb, else 0
julian = day - 32075l + 1461l*(yr+4800l+L)/4 + $
367l*(mn - 2-L*12)/12 - 3*((yr+4900l+L)/100)/4
julian = double(julian) + (HR/24.0D) - 0.5D
return
end
Friday, October 10, 2008
[SubRT] Easy 2D Contour Plot
David Pace, graduate student at UCLA, made a nice IDL SR for contour plot.

Conmake.pro is very useful and easy to use.
Some examples are showing here.
Fig. 1: Example contour illustrating axis labels and colorbar.
The command to produce this contour is,
IDL> conmake, input, xaxis, yaxis, 256, xlab=2, ylab=2, /cbar
where input (two dimensional array), xaxis (one dimensional array), and yaxis (one dimensional array) were IDL variables.
IDL> conmake, input, xaxis, yaxis, 256, xlab=2, ylab=2, /cbar
where input (two dimensional array), xaxis (one dimensional array), and yaxis (one dimensional array) were IDL variables.
The command to produce this contour is,
IDL> conmake, input, xaxis, yaxis, 256, xlab=2, ylab=2, overp=opinput
where opinput is a two dimensional array. The array to be overplotted should have the same scaling with the x and y axes as the main contour so that a sensible output results.
IDL> conmake, input, xaxis, yaxis, 256, xlab=2, ylab=2, overp=opinput
where opinput is a two dimensional array. The array to be overplotted should have the same scaling with the x and y axes as the main contour so that a sensible output results.
Thursday, October 9, 2008
[SubRT] Simple 2D Contour-Map
A nice blogger, Atmoz released the free open IDL source code (thanks!), CONTOUR_ON_MAP.PRO.
The code can be broken down into the following sections:
Below pretty figures are exmaples of the principan component analysis of the last ~50 years of winter geopotential height anomalies by Atmoz.
Orthographic Projection:

Mercator Projection:

Sinusoidal Interrupted Mollweide Projection:

The code can be broken down into the following sections:
Below pretty figures are exmaples of the principan component analysis of the last ~50 years of winter geopotential height anomalies by Atmoz.
Orthographic Projection:
Mercator Projection:
Sinusoidal Interrupted Mollweide Projection:
[SubRT] Colorbar
Anyone who have had a trouble with making a beautiful graphic with one's own data, must visit the website of David Fanning. The web will give a lot of help.
One of useful subroutine is 'colorbar.pro' (courtesy D. Fanning) to insert colorbar to the graphic imagery.

One of useful subroutine is 'colorbar.pro' (courtesy D. Fanning) to insert colorbar to the graphic imagery.
Wednesday, October 8, 2008
[SubRT] Mie Scattering Cacluation
Figure. Example of Mie Scattering of Single Dielectric Sphere (Dielectric:78nm, Wavelength:633 nm) (image from Havard Univ. Xie group)
IDL subroutin, BHMIE.pro can compute MIE scattering theory based on the fortran code from Bohren & Huffman (1983).
Another code, mie_ray_plot.pro can compute Mie/Rayleigh scattering cross section.
Tuesday, October 7, 2008
[Function] Air Mass Calculation
Function AirMass, Angle
; ********************************************************
; IDL Function to calculate air mass ; *********************************************************
; Air Mass = COS(Sun Zenith Angle or Sensor View Angle)
;
; 2008. 10. 4
; WRITTEN BY Kwon H. Lee (kwonho.lee@gmail.com)
;=============================================
XG=Angle*!dtor
IF(Angle GE 60.0) THEN begin
AMass=COS(XG)+0.50572*((6.07995+90.0-Angle)^(-1.6364))
endif ELSE begin
AMass=COS(XG)
ENDelse
return, Amass
end
; ********************************************************
; IDL Function to calculate air mass ; *********************************************************
; Air Mass = COS(Sun Zenith Angle or Sensor View Angle)
;
; 2008. 10. 4
; WRITTEN BY Kwon H. Lee (kwonho.lee@gmail.com)
;=============================================
XG=Angle*!dtor
IF(Angle GE 60.0) THEN begin
AMass=COS(XG)+0.50572*((6.07995+90.0-Angle)^(-1.6364))
endif ELSE begin
AMass=COS(XG)
ENDelse
return, Amass
end
Subscribe to:
Posts (Atom)
