nansencenter / nansat

Scientist friendly Python toolbox for processing 2D satellite Earth observation data.
http://nansat.readthedocs.io
GNU General Public License v3.0
181 stars 66 forks source link

When I run the sea_ice_drift simple.py sample code, I get an error like this: #544

Open LooperzZ opened 4 months ago

LooperzZ commented 4 months ago

C:\software\Anaconda3\envs\nansat3.9\python.exe D:\Python_code\sea_ice_drift-master\examples\simple1.py DLL load failed while importing _pixfun_py3: 找不到指定的模块。 C:\software\Anaconda3\envs\nansat3.9\lib\site-packages\nansat-1.5.3-py3.9-win-amd64.egg\nansat__init__.py:30: UserWarning: Cannot register C pixel functions! Either nansat was not installed using setup.py or pixel functions were not compiled automatically. For development, use "python setup.py build_ext --inplace" to compile pixel functions manually into the source tree.

warnings.warn('''Cannot register C pixel functions! Cannot add landmask VMIN: -22.628240203857423 VMAX: -9.868122138977043 Cannot add landmask VMIN: -23.267868041992188 VMAX: -10.92607064247131 96% 00368.7 00054.9 00388.0 00091.0 +00.0 0.84 13.59 Pattern matching - OK! ( 2 sec) Traceback (most recent call last): File "D:\Python_code\sea_ice_drift-master\examples\simple1.py", line 69, in s01 = sid.n1['sigma0_HV'] File "C:\software\Anaconda3\envs\nansat3.9\lib\site-packages\nansat-1.5.3-py3.9-win-amd64.egg\nansat\nansat.py", line 179, in getitem band_data = band.ReadAsArray() File "C:\software\Anaconda3\envs\nansat3.9\lib\site-packages\osgeo\gdal.py", line 3657, in ReadAsArray return gdal_array.BandReadAsArray(self, xoff, yoff, File "C:\software\Anaconda3\envs\nansat3.9\lib\site-packages\osgeo\gdal_array.py", line 450, in BandReadAsArray _RaiseException() File "C:\software\Anaconda3\envs\nansat3.9\lib\site-packages\osgeo\gdal_array.py", line 203, in _RaiseException raise RuntimeError(gdal.GetLastErrorMsg()) RuntimeError: /vsimem/WRFPFU86VJ.vrt, band 1: IReadBlock failed at X offset 0, Y offset 0: VRTDerivedRasterBand::IRasterIO:Derived band pixel function 'OnesPixelFunc' not registered.

aperrin66 commented 4 months ago

It looks like the pixel manipulation functions of nansat were not compiled during the installation. There was an issue with the package metadata that might have caused this. It has been fixed in nansat 1.6.2. The issue with the pixel functions might also come from your environment. You need to have a C compiler and GDAL installed.

Here are some steps you can take to try and fix this: