User Tools

Site Tools


internal:administration:idl

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
internal:administration:idl [2026/03/20 19:58] – [contour] janinternal:administration:idl [2026/07/18 07:57] (current) – [type setting] jan
Line 626: Line 626:
   * As matrix operations are faster than for-loops this may speed up your code a lot ...   * As matrix operations are faster than for-loops this may speed up your code a lot ...
  
 +  * Alternatively one may use **rebin** , but note that rebin uses bilinear interpolation (sample=0) or nearest neigbor (sample=1) and accordingly might be a bit slower 
 +
 +  x = fltarr(Nx)
 +  y = fltarr(Ny)
 +  xx = rebin( x, Nx, Ny, sample=1 )
 +  yy = transpose(rebin( y, Ny, Nx ))
 +
 +  
 ==== procedure names ==== ==== procedure names ====
  
Line 815: Line 823:
   ss[0] = 'wind speed'   ss[0] = 'wind speed'
   ss[1] = 'm/s'   ss[1] = 'm/s'
 +
 +An array of strings can be also be splitted element by element, but only from Idl version 8. onwards. 
 +The result will be a  [[https://www.nv5geospatialsoftware.com/docs/list.html|LIST-Object]] , which might be converted to an array by using its method [[https://www.nv5geospatialsoftware.com/docs/list.html#ToArrayMethod|List::toArray()]] (note the brackets!).
 +
 +  s = [ 'a=b', 'c=d', 'e=f' ]
 +  sL = STRSPLIT( s, '=', /ex, count=N )
 +  sA = (STRSPLIT( s, '=', /ex, count=N )).toArray(  ) ; equal to sA = sL.toArray()
 +
 +Result %%sL%% will be a %%LIST%% object with N elements, and every entry of sL an array of strings with elements accorrding to the result fo strsplit.
 +Parameter %%N%% will be an array with the number of splits that could be made per element.
 +The conversion %%sL.toArray()%% works only if every entry in sL has the same number of elements.
 +The %%sA%% array would allow you to search for certain values in the array by using the where functions - eg:
 +
 +  ia = where( sA[*,0] eq 'a', Na )
 +
 +But you could also try to use the %%WHERE%% method of the %%LIST%% object ...
 +
  
  
Line 821: Line 846:
  
  
-filenames can be separated into path and name by +filenames can be separated into path and name with 
-  file_dirname( <path to file> ) +  f_dn = file_dirname( <path to file> ) 
-  file_basename( <path to file> )+  f_bn = file_basename( <path to file> ) 
 + 
 +where the dirname will have no '/' charcater. 
 + 
 +You may use strsplit to strip or get the 'filename extension' - the part of the filename after the last dot: 
 +  f_ext = (STRSPLIT( f_bn, '.', /ex, count=N ))[N-1] 
 +  f_bnx = STRJOIN((STRSPLIT( f_bn, '.', /ex, count=N ))[0:N-2],'.'
  
 ==== formatted output ==== ==== formatted output ====
Line 1769: Line 1801:
     xrange = [ 0.5 * hour, 2*1e6 ], $     xrange = [ 0.5 * hour, 2*1e6 ], $
     /xlog, $     /xlog, $
-    xticks = N_ticks-1, $  ; holy IDL - why do you need things like this ?+    xticks = N_ticks-1, $  ; xticks is the number of //intervals// not ticks!,  holy IDL - why do you need things like this ?
     xtickname = x_tiknams, $     xtickname = x_tiknams, $
     xtickv    = x_tikvals, $     xtickv    = x_tikvals, $
Line 2166: Line 2198:
 The following commands are available (see also IDL help [[https://www.nv5geospatialsoftware.com/docs/Embedded_Formatting_Comm.html|Embedded Formatting Commands]])((find it under 'fonts' in the help)): The following commands are available (see also IDL help [[https://www.nv5geospatialsoftware.com/docs/Embedded_Formatting_Comm.html|Embedded Formatting Commands]])((find it under 'fonts' in the help)):
  
-  * supersuperscript  !U ('Up' faktor 0.62) +  * superscript  !U ('Up' faktor 0.62 or -38%
-  * subscript    !D ('Down' faktor 0.62) +  * subscript    !D ('Down' faktor 0.62 or -38%
-  * subsubscript !L ('Low' faktor 0.62) +  * subsubscript !L ('Low' faktor 0.62 or -38%
-  * index        !I (faktor 0.44) +  * index        !I (faktor 0.44 or -56%
-  * exponent     !E (faktor 0.44)+  * exponent     !E (faktor 0.44 or -56%)
   * back to Normal !N   * back to Normal !N
-  * numerator position !A ('above' division line) +  * numerator !A ('above' division line) 
-  * denominator position !B ('below' division line)+  * denominator !B ('below' division line)
   * new line !C ('carriage return')   * new line !C ('carriage return')
   * special characters !Z(b1[,b2[,...]]) where b1,b2,... are the 16 bit hexadecimal unicode codes of the desired character[s]   * special characters !Z(b1[,b2[,...]]) where b1,b2,... are the 16 bit hexadecimal unicode codes of the desired character[s]
Line 2180: Line 2212:
   * exclamation mark !!   * exclamation mark !!
  
-Most of these commands only affect the vertical position except for %%!R%% which restrores also the horizontal position.+Most of these commands only affect the vertical position except for %%!R%% which restores also the horizontal position. 
 + 
 +The exponent (%%!E%%) and index (%%!I%%) charactersizes are really tiny, better use the %%!U%% and %%!D%%. 
 + 
 +To test you may use 
 +  xyouts, 100,100, 'look!S!Uup!N!R!Ddown!N!Llow!N do!S!Iidx!N!R!Eexp!N !S!Anumerator!R!Bdemnominator!N', /device, charsize=1
  
 Examples: Examples:
Line 3819: Line 3856:
 If you want to interpolate only over certain dimensions they must be the last ones. You may use transpose to rearrange. Lets assume you have an array depending on x, y and time, i.e. z=fltarr(Nx,Ny,Nt) and you want to interpolate to certain x and y coordinates you can do this as follows: If you want to interpolate only over certain dimensions they must be the last ones. You may use transpose to rearrange. Lets assume you have an array depending on x, y and time, i.e. z=fltarr(Nx,Ny,Nt) and you want to interpolate to certain x and y coordinates you can do this as follows:
  
-  z_ipol = transpose( interpolate( transpose(z_org,[2,0,1]) , ix_ipol , iy_ipol , /grid  ), [1,2,0] )+  z_ipol = transpose( interpolate( transpose(z_org,[2,0,1]) , ix_ipol , iy_ipol , /grid, MISSING=!VALUES.f_nan  ), [1,2,0] )
  
 +The /GRID flag allow to use different sizes for ix_ipol and iy_ipol and the MISSING keyword sets values of z_ipol outside the ranges of z_org to the missing value (no extrapolation).
  
  
internal/administration/idl.1774036727.txt.gz · Last modified: by jan