Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
LooperzZ opened this issue May 12, 2024 · 1 comment
Assignees

Comments

@LooperzZ
Copy link

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 aperrin66 self-assigned this May 13, 2024
@aperrin66
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants