idl-programming-language

How to generate the lineared color plot (cplot) with z values in colorbar

瘦欲@ 提交于 2021-01-28 11:28:06
问题 In MATLAB™ one can use cplot.m which can generate colored plot basically looks like 2d plot with 3rd axis (z-axis) value as colorbar. Is there any tool/plotting technique I can use to generate a similar plot in Python or IDL Programming Language?. The previous question on stack overflow dealing with different problem as given in a link. 回答1: IDL v8 has an easy to use keyword for the PLOT function called VERT_COLORS: ; generate some sample data x = cos(dindgen(100)/20) y = sin(dindgen(100)/20)

How to read fortran 77 unformatted binary file into python

妖精的绣舞 提交于 2020-01-13 04:43:19
问题 I have a script in IDL which reads an unformatted binary file (F77) and outputs it as a .sav file but I want to convert this script to python and save as an .npz file and I am having trouble on the read line. IDL Code: ;create save file for QBO model output ;--------------------------------------------------------------------- ;input data here (Only adjust this info) ;--------------------------------------------------------------------- time=7300 ;duration from fortran code tstep=5 ;time step

Scipy map_coordinates bilinear interpolation compared to interp and IDL interpolate

让人想犯罪 __ 提交于 2020-01-02 04:10:14
问题 I'm in the process of rewriting a coworkers IDL code into python and am coming up with some differences that I'm confused about. According to other SO questions and mailing list threads I've found if you use scipy.ndimage.interpolation.map_coordinates and specify order=1 it is supposed to do bilinear interpolation. When comparing results between the IDL code (run in GDL) and python (map_coordinates) I got different results. Then I tried using mpl_toolkits.basemap.interp and I got the same

python scipy.stats.powerlaw negative exponent

空扰寡人 提交于 2019-12-30 02:28:07
问题 I want to supply a negative exponent for the scipy.stats.powerlaw routine, e.g. a=-1.5, in order to draw random samples: """ powerlaw.pdf(x, a) = a * x**(a-1) """ from scipy.stats import powerlaw R = powerlaw.rvs(a, size=100) Why is a > 0 required, how can I supply a negative a in order to generate the random samples, and how can I supply a normalization coefficient/transform, i.e. PDF(x,C,a) = C * x**a The documentation is here http://docs.scipy.org/doc/scipy/reference/generated/scipy.stats

Dimension of a TIF file as “420x560x3” - Matlab to IDL

江枫思渺然 提交于 2019-12-13 01:40:38
问题 I am trying to create a movie in Matlab using series of functions under VideoWriter function. My code is somewhat like one shown below: vidObj=VideoWriter('movie.avi'); open(vidObj); for i=1:N %N is number of frames [nx,ny]=coordinates(Lx,Ly,Nx,Ny,[x(i),-y(i)]); %Lx and Ly refer to the length and height in meters. %Nx and Ny are number of pixels (boxes) and fit into the respective L's. %If Lx=10e-6 , with Nx=5, there will be 5 pixels in x dimension, %each of length 2e-6 m. [xf,yf]=ndgrid(nx

How to declare variables in for loop? (IDL)

梦想与她 提交于 2019-12-12 20:07:17
问题 For example, My files are naming after 00.dat, 01.dat, 02.dat ..., each file contains multiple columns and I use READCOL to read them into variables. for i = 0, n-1 do begin readcol, string(i, F='(I02)')+'.dat', F='D,D', a0, b0 readcol, string(i, F='(I02)')+'.dat', F='D,D', a1, b1 . . c1 = a1 / a0 c2 = a2 / a0 . . d1 = b1 / b0 d2 = b2 / b0 . . endfor This works fine, but I cannot type all the varialbes one by one if there will be, say, one hundred variables. Therefore, I want to use for loop

What's the most basic way to format a 2D matrix of doubles in binary for reading into IDL?

删除回忆录丶 提交于 2019-12-11 06:49:22
问题 So I have an i by j matrix of doubles in C++ that I want to read into an IDL program. Lets say that the matrix is called data, with size ROWS by COLS, and name string saved to filename. And I just write the values out in a stream to a binary file. ofstream myfile (filename, ios::binary); if(myfile.isopen()) { for (int i = 0; i < ROWS; i++){ for (int j=0; j < COLS; j++){ myfile<<data.at(i,j); } myfile.close(); I then want to read it back into IDL but I'm new to working with binary in IDL and

Calling an IDL script in Python

和自甴很熟 提交于 2019-12-11 02:38:17
问题 I would like to run an IDL script in a python code, since I need to analyse the results of IDL code later in the python script but I have no idea how it works. I want to call this IDL script for example in a python code: pro plotgaussian, center, sigma, X=x, Y=y x = findgen(1000) / 999; numbers running 0 to 1 in steps of 0.001 x = x * 6 * sigma - 3 * sigma; widen x to range over 6 sigma x = x + center; center the x range on the bell curve center arg = ((x – center)/sigma)^2 y = exp(-arg) plot

reading a binary file in python

时间秒杀一切 提交于 2019-12-10 09:21:52
问题 I have to read a binary file in python. This is first written by a Fortran 90 program in this way: open(unit=10,file=filename,form='unformatted') write(10)table%n1,table%n2 write(10)table%nH write(10)table%T2 write(10)table%cool write(10)table%heat write(10)table%cool_com write(10)table%heat_com write(10)table%metal write(10)table%cool_prime write(10)table%heat_prime write(10)table%cool_com_prime write(10)table%heat_com_prime write(10)table%metal_prime write(10)table%mu if (if_species

reading a binary file in python

╄→гoц情女王★ 提交于 2019-12-05 13:20:05
I have to read a binary file in python. This is first written by a Fortran 90 program in this way: open(unit=10,file=filename,form='unformatted') write(10)table%n1,table%n2 write(10)table%nH write(10)table%T2 write(10)table%cool write(10)table%heat write(10)table%cool_com write(10)table%heat_com write(10)table%metal write(10)table%cool_prime write(10)table%heat_prime write(10)table%cool_com_prime write(10)table%heat_com_prime write(10)table%metal_prime write(10)table%mu if (if_species_abundances) write(10)table%n_spec close(10) I can easily read this binary file with the following IDL code: n1