nansat icon indicating copy to clipboard operation
nansat copied to clipboard

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

Open LooperzZ opened this issue 9 months ago • 1 comments

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.

LooperzZ avatar May 12 '24 13:05 LooperzZ

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:

  • make sure you have a C compiler installed
  • make sure GDAL is installed (the easiest way to do this is through Anaconda, which you seem to be using)
  • install nansat version 1.6.2 (pip install nansat==1.6.2)
  • try again to execute the code sample from sea_ice_drift

aperrin66 avatar May 21 '24 11:05 aperrin66