Search code examples
pythonidl-programming-language

Decode IASI Satellite Spectrum - convert IDL to python


Since I have no experience in IDL coding, I need help converting the piece of code below to python.

The following parameters are known and are 1D arrays oder scalars.

IDefScaleSondNbScale, IDefScaleSondScaleFactor,
IDefScaleSondNsfirst, IDefScaleSondNslast,
IDefNsfirst

enter image description here


Solution

  • It's IDL and the python equivalent is the following:

    SpectDecoded = np.empty_like(Spect, dtype=float)
    for numScale in range(1, int(IDefScaleSondNbScale) + 1):
        SF = IDefScaleSondScaleFactor[numScale - 1]
        for chanNb in range(int(IDefScaleSondNsfirst[numScale - 1]), int(IDefScaleSondNslast[numScale - 1]) + 1):
            w = int(chanNb - IDefNsfirst[0])
            if w < SpectDecoded.shape[0]:
                SpectDecoded[w] = Spect[w] * 10 ** (-SF)