; 2015 | Michael Ian Lapsley

Pre, Pro, what the heck!

I was corrected by Word when I wrote "proceed" when I meant to say precede. I was impressed by Word's ability to recognize that I had used the incorrect word and thankful that it save me from embarrassment (although I am not admitting to the embarrassing behavior). I said to myself, "You dummy pre- means before and pro means moving forward or after." Then... I wrote the word proactive... Proactive means to do something BEFORE to prevent something from happening in the future. Now why is this word not Preactive?

Additionally, why is -"ceed" (or "cede") different in proceed and precede?

Good grief!

Classical Music

Mike's list of good classical songs

I was listening to some classical music the other day and realized I like some classical but not all. The names for the songs are so obscure it makes them hard to remember. Thus, I will create a list of songs that I like here:
  • Bach - Cello Suite No.1 in G Prelude
  • Bach - Prelude in C Major -- Awesome!
  • Bach - Siciliano BWV 1031 for Piano and Orchestra
  • Bach - Well Tempered Clavier Book 1
  • Camille Saint-SaĆ«ns - Danse Macabre -- Creepy
  • Beethoven - Piano concerto No 14 (Moonlight Sonata)
  • Pachelbel - Canon in D Major
  • Claude Debussy - Clair de Lune
  • Claude Debussy - Reverie
  • Chopin - Nocturne Op.9 No.2 (Arthur Rubinstein)

Neoclassical:

  • Yiruma - River Flows in You
  • Karl Jenkins - Adiemus
  • Two Steps From Hell - Eria (weird name but good music)

IDL Notebook: Variables, Data Storage, and Data Types

It is important to choose the best data storage for your application. A good list of all IDL data types is given here:
http://www.exelisvis.com/docs/IDL_Data_Types.html


I am organizing this page in terms of data storage elements.

Array (vector)

Arrays can be made from several data types such as bytes, integers, floats and doubles.
see: http://michaellapsley.blogspot.com/2015/03/idl-notebook-arrays.html

Arrays are very useful for mathematical calculations typical for solving linear systems. Arrays can take advantage of matrix algebra and transformations.

The size of the array must be defined at its creation. The size can change but changing the size of an array in a loop can cause issues. Arrays must remain rectangular (All rows are the same length; All columns are the same length).

List

Lists (http://www.exelisvis.com/docs/LIST.html) can be made from any data type, but a single list can only contain elements of one data type. Lists are one dimensional
Lists are useful because their length must not be defined. This is useful in cases where you might not know how long the list will become. For example, if you are writing a loop to search for the number of times a event occurs when that number is initially unknown.

First, initialize the list:
IDL> list1 = list()
Then add stuff to the list:
IDL> list1.add,1
IDL> list1.add,10
IDL> list1.add,100
IDL> list1.add,2
IDL> print, list1
1
10
100
2

Then convert the list to an array:
IDL> array1 = list1->toarray()
IDL> print,array1
1 10 100 2
There are lots of other list operations (http://www.exelisvis.com/docs/LIST.html)

Structures

Structures (http://www.exelisvis.com/docs/Creating_and_Defining_St.html) are useful because you can sort different types of elements in a structure. Elements of structures can be in of different data types and different sizes. This allows flexible data management in IDL.
IDL> structure1 = {item1:list1,item2:array1,item3:'[1,2,3,4,5]', item4:['fish','duck']}
IDL> print,structure1
{<ObjHeapVar5(LIST)> 1 10 100 2
[1,2,3,4,5]
fish duck
}
IDL> print,structure1.item1
1
10
100
2

There are many ways to define and alter structures. Structures can even store other structures, giving the user the ability to create multi-dimensional data structures.
IDL> structure2 = {thing1:structure1,thing2:structure1}

IDL> print,structure2
{{<ObjHeapVar5(LIST)> 1 10 100 2
[1,2,3,4,5]
fish duck
}{<ObjHeapVar5(LIST)>
1 10 100 2
[1,2,3,4,5]
fish duck
}}
The user can immediately access any level of a multidimensional structure.






IDL> print,structure2.thing1.item1
1
10
100
2


Enjoy


Objects

http://hesperia.gsfc.nasa.gov/rhessidatacenter/complementary_data/objects/objects.html

IDL Notebook: arrays

IDL Notebook: Arrays
As simple as you think it might be, I always need to look up the correct function necessary to create the type of array that I need in IDL.
Here is a good reference: http://www.cis.rit.edu/class/simg211/Vectors_and_Arrays.html
BINDGEN Return a byte array with each element set to its subscript.
IDL> print, bindgen(10)
       0 1 2 3 4 5 6 7 8 9
BYTARR Create a byte vector or array.
IDL> print, bytarr(10)
       0 0 0 0 0 0 0 0 0 0
FINDGEN Return a floating-point array with each element set to its subscript.
IDL> print, findgen(10)
       0.000000 1.00000 2.00000 3.00000 4.00000 5.00000 6.00000 7.00000 8.00000 9.00000
FLTARR Return a floating-point vector or array.
IDL> print, fltarr(10)
       0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000 0.000000
INDGEN Return an integer array with each element set to its subscript.
IDL> print, indgen(10)

       0 1 2 3 4 5 6 7 8 9

INTARR Return an integer vector or array.
IDL> print, intarr(10)
       0 0 0 0 0 0 0 0 0 0
LINDGEN Return a longword integer array with each element set to its subscript.
IDL> print, lindgen(10)
       0 1 2 3 4 5 6 7 8 9
LONARR Return a longword integer vector or array.
IDL> print, lonarr(10)
       0 0 0 0 0 0 0 0 0 0
DINDGEN Return a double integer array wit each element set to its subscript
IDL> print,dindgen(10)
      0.00000000       1.0000000       2.0000000       3.0000000       4.0000000       5.0000000       6.0000000       7.0000000       8.0000000       9.0000000
DBLARR Return a double integer vector or array
IDL> print,dblarr(10)
      0.00000000      0.00000000      0.00000000      0.00000000      0.00000000      0.00000000      0.00000000      0.00000000      0.00000000      0.00000000
IDENTITY Return an identity array.
IDL> print, identity(3)
        1.00000 0.000000 0.000000
       0.000000  1.00000 0.000000
       0.000000 0.000000  1.00000
MAKE_ARRAY General purpose array creation.
REPLICATE Form array of given dimensions filled with a value.
IDL> print, replicate(1,4,3)
       1 1 1 1
       1 1 1 1
       1 1 1 1


STRARR Return and array of srings
 (http://www.exelisvis.com/docs/STRARR.html)

IDL Notebook: Plot

IDL Notebook: Examples and references from lessons learned while using IDL

Plot formatting examples:

; Plot
p = plot($

          x,y, $
          name = 'NameStr', $
          color = 'blue', $
          symbol = 'o',$
          margin=[0.1,0.1,0.2,0.14])

leg      = legend(position = [1,0.86])
p.xrange = [0,100]
p.yrange = [-0.2,1.2]
p.xtitle = 'XTitleStr'
p.ytitle = 'YTitleStr'
p.title  = 'TitleStr'


p.save,'ouputDirStr'+'fileNameStr'+'.png',resolution=300
p.close

-----------------------------------

Manually create legend:

;create legend
leg1 = legend()
leg1[1-1].label = ['ir source - atmosphere absorption']
for i = 1,size(alldarns,/n_elements) do begin
  leg1[i-1+1].label = ['channel:'+strtrim(channel[i-1],2)+' sern:'+allserns[i-1]+' darn:'+alldarns[i-1]]
endfor

-------------------------------------

Plot with N colors:

colorsN = unique_colors(N,/duller)
FOR I = 0,N-1 DO BEGIN
 PL1 = PLOT(x,y,color=colorsN[*,I],/OVERPLOT)
END

------------------------------------