UMR-CNRM / EPyGrAM

Enhanced Python for Graphics and Analysis of Meteorological fields
Other
14 stars 15 forks source link

Error when computing spectrum from a Meso-NH nectcdf file #17

Closed SebastienRietteMTO closed 4 months ago

SebastienRietteMTO commented 1 year ago

When r is a resource built from a Meso-NH netcdf file:

u = r.readfield('UT').getlevel(k=36) v = r.readfield('VT').getlevel(k=36) ke = uu + vv ske = ke.dctspectrum()

ValueError Traceback (most recent call last) /tmp/ipykernel_53463/4165553912.py in 4 ke = uu + vv 5 ----> 6 ske = ke.dctspectrum() 7 ske.name = "MésoNH: kinetic energy at L36" 8

/home/common/epygram/EPyGrAM-dev/epygram/fields/D3Field.py in dctspectrum(self, subzone, level_index, validity_index) 1500 if subzone is None and self.geometry.grid.get('LAMzone', None) is not None: 1501 subzone = 'C' -> 1502 variances = esp.dctspectrum(field2dt0.getdata(subzone=subzone)) 1503 spectrum = esp.Spectrum(variances[1:], 1504 name=str(self.fid),

/home/common/epygram/EPyGrAM-dev/epygram/spectra.py in dctspectrum(x, verbose, log) 258 log.info("dctspectrum: compute DCT transform...") 259 norm = 'ortho' # None --> 260 y = tfm.dct(tfm.dct(x, norm=norm, axis=0), norm=norm, axis=1) 261 262 # compute spectrum

/usr/lib/python3/dist-packages/scipy/fftpack/_realtransforms.py in dct(x, type, n, axis, norm, overwrite_x) 373 374 """ --> 375 return _pocketfft.dct(x, type, n, axis, norm, overwrite_x) 376 377

/usr/lib/python3/dist-packages/scipy/fft/_pocketfft/realtransforms.py in _r2r(forward, transform, x, type, n, axis, norm, overwrite_x, workers, orthogonalize) 32 overwrite_x = overwrite_x or copied 33 elif tmp.shape[axis] < 1: ---> 34 raise ValueError("invalid number of data points ({0}) specified" 35 .format(tmp.shape[axis])) 36

ValueError: invalid number of data points (0) specified