idl-programming-language

Scipy map_coordinates bilinear interpolation compared to interp and IDL interpolate

梦想的初衷 提交于 2019-12-05 11:34:58
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 result as the IDL code. Below is a simple example that shows what is wrong. Could someone help me figure

How to read fortran 77 unformatted binary file into python

可紊 提交于 2019-12-04 12:24:22
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 from fortran code inputfile='/home/cwilliams/Metr_205/qbo/uvwtom.'; binary file from fortran

python scipy.stats.powerlaw negative exponent

我的未来我决定 提交于 2019-11-30 10:10:29
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.powerlaw.html Thanks! EDIT: I should add that I'm trying to replicate IDL's RANDOMP function: http:/