internal:administration:idl
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| internal:administration:idl [2026/03/19 20:50] – [contour] jan | internal:administration:idl [2026/04/28 08:26] (current) – [interpolation] 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] = ' | ss[1] = ' | ||
| + | |||
| + | 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:// | ||
| + | |||
| + | s = [ ' | ||
| + | sL = STRSPLIT( s, ' | ||
| + | sA = (STRSPLIT( s, ' | ||
| + | |||
| + | 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 ' | ||
| + | |||
| + | 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> ) | + | |
| - | file_basename( <path to file> ) | + | |
| + | |||
| + | where the dirname will have no '/' | ||
| + | |||
| + | You may use strsplit to strip or get the ' | ||
| + | f_ext = (STRSPLIT( f_bn, ' | ||
| + | f_bnx = STRJOIN((STRSPLIT( f_bn, ' | ||
| ==== 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 // |
| xtickname = x_tiknams, $ | xtickname = x_tiknams, $ | ||
| xtickv | xtickv | ||
| Line 3093: | Line 3125: | ||
| === line patterns === | === line patterns === | ||
| - | contour | + | contour |
| contour, z, x, y, $ | contour, z, x, y, $ | ||
| levels = levels, $ | levels = levels, $ | ||
| c_orientation = [ 0 , 22, 45, 90, ... ] , $ ; orientation of the lines in degrees | c_orientation = [ 0 , 22, 45, 90, ... ] , $ ; orientation of the lines in degrees | ||
| - | c_spacing = 0.5 ; spacing between lines in cm | + | c_spacing = [ 1, 0.5, 0.25, ... ] ; spacing between lines in cm |
| | | ||
| === Path of contour lines === | === Path of contour lines === | ||
| - | contour provide the pathes of the contour lines: | + | contour |
| contour, z, x, y, $ | contour, z, x, y, $ | ||
| Line 3111: | Line 3143: | ||
| / | / | ||
| / | / | ||
| - | /overplot ; avoid contour to rescale the axes - if you alread | + | |
| + | | ||
| - | path_info is an array of CONTOUR_PATH_STRUCTURE. The number of elelemtns gives the numbefr | + | path_info is an array of CONTOUR_PATH_STRUCTURE. The number of elelemtns gives the number |
| - | Elements offset and N give the starting index and length of every isoline in path_xy. | + | Elements |
| You can then use the pathes in poly_fill to do transparent hatch patterns: | You can then use the pathes in poly_fill to do transparent hatch patterns: | ||
| for i = 0, n_elements(path_info)-1 do begin | for i = 0, n_elements(path_info)-1 do begin | ||
| - | | + | |
| - | ii = path_info_i.offset + lindgen(path_info_i.N) | + | |
| polyfill, path_xy[0, | polyfill, path_xy[0, | ||
| endfor ; i | endfor ; i | ||
| Line 3126: | Line 3158: | ||
| You could also use polyfill to put a byte pattern or wrap an image between the isolines ... | You could also use polyfill to put a byte pattern or wrap an image between the isolines ... | ||
| + | c = 255 | ||
| + | pattern = [ $ | ||
| + | [ 0, 0, 0, 0, 0, 0, 0 ], $ | ||
| + | [ 0, 0, 0, c, 0, 0, 0 ], $ | ||
| + | [ 0, 0, c, c, c, 0, 0 ], $ | ||
| + | [ 0, c, c, c, c, c, 0 ], $ | ||
| + | [ 0, 0, c, c, c, 0, 0 ], $ | ||
| + | [ 0, 0, 0, c, 0, 0, 0 ], $ | ||
| + | [ 0, 0, 0, 0, 0, 0, 0 ] $ | ||
| + | ] | ||
| + | for i = 0, n_elements(path_info)-1 do begin | ||
| + | ii = path_info[i].offset + lindgen(path_info[i].N) | ||
| + | polyfill, path_xy[0, | ||
| + | endfor ; i | ||
| + | |||
| + | But i do not understand how the transparent thing works - in this example it does not work. And if i understood it right i need to provide IMAGE_COORD, | ||
| + | see NV5 help for [[https:// | ||
| === color bar === | === color bar === | ||
| - | You can use contour | + | You may want to have a color bar setting the colorshading in relation to values. |
| + | You can use contour to make a **color bar**: | ||
| A **horizontal** color bar at the bottom | A **horizontal** color bar at the bottom | ||
| Line 3801: | Line 3851: | ||
| 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, | 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, | ||
| - | z_ipol = transpose( interpolate( transpose(z_org, | + | z_ipol = transpose( interpolate( transpose(z_org, |
| + | 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.1773953410.txt.gz · Last modified: by jan
