问题标签 [pyhdf]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
36 浏览

python - 使用pyhdf时如何处理py2和py3中不同类型的np.array(list)?

我想通过pyhdf将一些东西保存为hdf中的变量。

这是我的代码:

它适用于 py2 并且b.type|S1.

但是,b.dtype<U1py3 中,运行代码的最后一行时出现此错误:

如果我添加b = b.astype('S1')py3,也会出现同样的错误。但是,b.dtype|S1

0 投票
1 回答
861 浏览

python - 如何从 MODIS 瓦片的角创建像素坐标网格?

我有一个 HDF4 文件,其 StructMetadata.0 包含以下属性:

这些是 L3 网格产品(正弦投影)的 MODIS 平铺的 X 和 Y 距离(以米为单位)。假设像素分辨率为 5 公里,我想提取/创建此图块中所有像素 (240 x 240) 的坐标。如何在 Python 中实现这一点?

0 投票
1 回答
504 浏览

python - 从 MODIS HDFEOS 数据生成网格信息文件

有没有办法从 python 中的 MODIS MCD19A2 文件生成网格信息(经纬度)?该文件从 链接下载到数据文件 。在 MATLAB 中,可以使用以下块代码完成

简而言之,我正在寻找MATLAB 包的 gd.readField 的 pyhdf/python 等效项

0 投票
1 回答
192 浏览

centos7 - 在 CentOS7 上安装 PyHDF

请帮忙,

我无法在 CentOS7 上安装 pyhdf。我应该说,我是 linux 的新手

Pyhdf 需要安装 HDF,到目前为止我已经尝试了以下方法:

  1. 首先使用 ./configure、gmake && gmake 检查安装 HDF。但是,检查退出有 6 个错误。

  2. 然后我使用“yum install hdf-devel”这样,HDF安装在计算机上,但pyhdf仍然存在错误。至于 phydf,我尝试了“ pip install pyhdf ”和“ python setup.py install ”,但总是以失败告终。有关详细信息,请参阅下面的日志。谢谢!

    $ python setup.py build running build running config_cc unifing config_cc, config, build_clib, build_ext, build commands --compiler options running config_fc unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options running build_src build_src build extension "pyhdf. _hdfext" 来源 build_src: 构建 npy-pkg 配置文件 运行 build_py 运行 build_ext 定制 UnixCCompiler 定制 UnixCCompiler 使用 build_ext 构建 'pyhdf._hdfext' 扩展编译 C 源 C 编译器: gcc -pthread -Wno-unused-result -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED= 1 -DNDEBUG -O2 -g -管道 -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -I/opt/rh/rh- python36/root/usr/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 - mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -std=c99

    编译选项:'-I/usr/local/hdf4/include -I/home/npec/oop/oop_venv/lib64/python3.6/site-packages/numpy/core/include -I/home/npec/oop/oop_venv /include -I/opt/rh/rh-python36/root/usr/include/python3.6m -c' 额外选项:'-DNOSZIP' gcc -pthread -shared -L/opt/rh/rh-python36/root/ usr/lib64-Wl,-z,relro -Wl,-rpath,/opt/rh/rh-python36/root/usr/lib64 -Wl,--enable-new-dtags build/temp.linux-x86_64-3.6/ pyhdf/hdfext_wrap.o -L/usr/local/hdf4/lib -L/usr/local/jpeg/lib -L/usr/local/zlib/lib -L/usr/local/jpeg/lib -L/usr/ local/zlib/lib -L/usr/local/szip/lib -L/usr/lib -L/usr/local/lib -L/lib -L/opt/rh/rh-python36/root/usr/lib64 - lmfhdf -ldf -ljpeg -lz -lpython3.6m -o build/lib.linux-x86_64-3.6/pyhdf/_hdfext.cpython-36m-x86_64-linux-gnu.so /usr/bin/ld: /usr/local/ hdf4/lib/libmfhdf.a(mfsd.o):重定位 R_X86_64_32 反对.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libmfhdf.a(putget.o): relocation R_X86_64_32S against制作共享对象时不能使用.rodata';使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libmfhdf.a(putgetg.o): 重新定位 R_X86_64_32 对.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libmfhdf.a(string.o): relocation R_X86_64_32 against.rodata.str1.1' 不能在制作共享对象时使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libmfhdf.a(var.o): 重定位 R_X86_64_32 针对.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libmfhdf.a(array.o): relocation R_X86_64_32S against.rodata' 不能在制作共享对象时使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libmfhdf.a(attr.o): 重定位 R_X86_64_32 针对.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libmfhdf.a(cdf.o): relocation R_X86_64_32 against.rodata.str1.1' 不能在制作共享对象时使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libmfhdf.a(dim.o): relocation R_X86_64_32 against.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libmfhdf.a(file.o): relocation R_X86_64_32 against undefined symbol制作共享对象时不能使用rlim';使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libmfhdf.a(hdfsds.o):.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libmfhdf.a(iarray.o): relocation R_X86_64_32 against在制作共享对象时不能使用针对 .rodata.str1.1' 的重定位 R_X86_64_32;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libmfhdf.a(error.o): relocation R_X86_64_32 against .rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libmfhdf.a(nssdc.o): relocation R_X86_64_32S against.rodata' 在制作共享对象时不能使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libmfhdf.a(xdrposix.o): 重定位 R_X86_64_32S 对.data' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(cszip.o): relocation R_X86_64_32 against.rodata.str1.8' 在制作共享对象时不能使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libdf.a(dfconv.o): relocation R_X86_64_32 against.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(dfgroup.o): relocation R_X86_64_32 against.rodata.str1.8' 制作共享对象时不能使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libdf.a(dfknat.o):.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(dfkswap.o): relocation R_X86_64_32 against制作共享对象时不能使用针对 .rodata.str1.8' 的重定位 R_X86_64_32;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libdf.a(hblocks.o):.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(hchunks.o): relocation R_X86_64_32 against制作共享对象时不能使用针对 .rodata.str1.8' 的重定位 R_X86_64_32;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libdf.a(hcomp.o):.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(herr.o): relocation R_X86_64_32S against制作共享对象时不能使用针对 .rodata 的重定位 R_X86_64_32;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libdf.a(hextelt.o): relocation R_X86_64_32 against.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(hfile.o): relocation R_X86_64_32 against.rodata.str1.8' 制作共享对象时不能使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libdf.a(hfiledd.o): 重定位 R_X86_64_32 针对.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(mcache.o): relocation R_X86_64_32 against.rodata.str1.8' 不能在制作共享对象时使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libdf.a(mfan.o):ANIanncmp' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(mstdio.o): relocation R_X86_64_32 against在制作共享对象时,不能使用针对符号 .rodata.str1.8' 的重定位 R_X86_64_32;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libdf.a(tbbt.o):.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(vattr.o): relocation R_X86_64_32 against制作共享对象时不能使用针对 .rodata.str1.8' 的重定位 R_X86_64_32;重新编译 -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(vg.o): relocation R_X86_64_32 against.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(vgp.o): relocation R_X86_64_32 against symbol制作共享对象时不能使用 vdestroynode';使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libdf.a(vhi.o):.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(vio.o): relocation R_X86_64_32 against制作共享对象时不能使用针对 .rodata.str1.8' 的重定位 R_X86_64_32;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libdf.a(vparse.o):.bss' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(vrw.o): relocation R_X86_64_32 against制作共享对象时不能使用针对 .rodata.str1.8' 的重定位 R_X86_64_32S;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libdf.a(vsfld.o):.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(atom.o): relocation R_X86_64_32S against制作共享对象时不能使用针对 .bss' 的重定位 R_X86_64_32;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libdf.a(bitvect.o): relocation R_X86_64_32S against.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(cdeflate.o): relocation R_X86_64_32 against.rodata.str1.8' 制作共享对象时不能使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libdf.a(cnbit.o): relocation R_X86_64_32 against .rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(cnone.o): relocation R_X86_64_32 against.rodata.str1.8' 在制作共享对象时不能使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libdf.a(crle.o):.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(cskphuff.o): relocation R_X86_64_32 against制作共享对象时不能使用针对 .rodata.str1.8' 的重定位 R_X86_64_32;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libdf.a(dynarray.o): 重定位 R_X86_64_32 对.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(glist.o): relocation R_X86_64_32 against.rodata.str1.8' 不能在制作共享对象时使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libdf.a(hbitio.o): relocation R_X86_64_32 against.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(hbuffer.o): relocation R_X86_64_32 against.rodata.str1.8' 制作共享对象时不能使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libdf.a(hcompri.o): 重定位 R_X86_64_32 对.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(vconv.o): relocation R_X86_64_32 against.rodata.str1.8' 不能在制作共享对象时使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libdf.a(dfcomp.o):.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(dfimcomp.o): relocation R_X86_64_32 against制作共享对象时不能使用针对 .bss' 的重定位 R_X86_64_32;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libdf.a(dfjpeg.o):hdf_init_destination' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libdf.a(dfrle.o): relocation R_X86_64_32S against在制作共享对象时,不能使用针对符号 .bss' 的重定位 R_X86_64_32S;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libdf.a(dfunjpeg.o):针对符号重定位 R_X86_64_32Shdf_init_source' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jcapimin.o): relocation R_X86_64_32 against.text' 在制作共享对象时不能使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jcapistd.o): 重定位 R_X86_64_32 对.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jcparam.o): relocation R_X86_64_32S against.rodata' 不能在制作共享对象时使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jcinit.o): 重定位 R_X86_64_32 对.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jcmaster.o): relocation R_X86_64_32S against.text' 在制作共享对象时不能使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jcmarker.o): 重定位 R_X86_64_32S 对符号jpeg_natural_order' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jcmainct.o): relocation R_X86_64_32S against.text' 在制作共享对象时不能使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jcprepct.o): relocation R_X86_64_32S against.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jccoefct.o): relocation R_X86_64_32S against.text' 在制作共享对象时不能使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jccolor.o):重新定位 R_X86_64_32S 对.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jcsample.o): relocation R_X86_64_32S against.text' 在制作共享对象时不能使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jchuff.o):jpeg_natural_order' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jcphuff.o): relocation R_X86_64_32S against在制作共享对象时,不能使用针对符号 .text' 的重定位 R_X86_64_32S;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jcdctmgr.o): 重定位 R_X86_64_32S 对.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jfdctfst.o): relocation R_X86_64_32 against.text' 不能在制作共享对象时使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jfdctflt.o): relocation R_X86_64_32 against.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jfdctint.o): relocation R_X86_64_32 against.text' 在制作共享对象时不能使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jdapimin.o): 重定位 R_X86_64_32S 对.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jdapistd.o): relocation R_X86_64_32 against.text' 不能在制作共享对象时使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jdmaster.o):.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jdinput.o): relocation R_X86_64_32S against制作共享对象时不能使用针对 .text' 的重定位 R_X86_64_32S;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jdmarker.o):.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jdhuff.o): relocation R_X86_64_32S against制作共享对象时无法使用针对 .rodata 的重定位 R_X86_64_32S;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jdphuff.o): relocation R_X86_64_32S against.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jdmainct.o): relocation R_X86_64_32S against.text' 在制作共享对象时不能使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jdcoefct.o): 重定位 R_X86_64_32S 对.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jdpostct.o): relocation R_X86_64_32S against.text' 不能在制作共享对象时使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jddctmgr.o): 重定位 R_X86_64_32 对符号jpeg_idct_2x2' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jidctfst.o): relocation R_X86_64_32 against.text' 不能在制作共享对象时使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jidctflt.o): 重定位 R_X86_64_32 对.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jidctint.o): relocation R_X86_64_32 against.text' 不能在制作共享对象时使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jidctred.o): relocation R_X86_64_32 against.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jdsample.o): relocation R_X86_64_32S against.text' 在制作共享对象时不能使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jdcolor.o): 重定位 R_X86_64_32S 对.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jquant1.o): relocation R_X86_64_32S against.text' 不能在制作共享对象时使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jquant2.o): 重定位 R_X86_64_32S 对.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jdmerge.o): relocation R_X86_64_32S against.text' 不能在制作共享对象时使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jcomapi.o):重新定位 R_X86_64_32 对.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jutils.o): relocation R_X86_64_32 against.text' 在制作共享对象时不能使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jerror.o): relocation R_X86_64_32S against.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libjpeg.a(jmemmgr.o): relocation R_X86_64_32S against制作共享对象时不能使用.rodata';使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libjpeg.a(jmemnobs.o): 重定位 R_X86_64_32 针对.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libz.a(deflate.o): relocation R_X86_64_32S against.rodata' 不能在制作共享对象时使用;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libz.a(inflate.o):.rodata' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libz.a(inftrees.o): relocation R_X86_64_32S against制作共享对象时不能使用针对 .rodata 的重定位 R_X86_64_32S;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libz.a(trees.o):.data' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libz.a(zutil.o): relocation R_X86_64_32 against制作共享对象时不能使用针对 .rodata.str1.1' 的重定位 R_X86_64_32S;使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libz.a(adler32.o): relocation R_X86_64_32 against.text' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: /usr/local/hdf4/lib/libz.a(crc32.o): relocation R_X86_64_32 against制作共享对象时不能使用.rodata';使用 -fPIC /usr/bin/ld 重新编译:/usr/local/hdf4/lib/libz.a(inffast.o): 重定位 R_X86_64_32S 对 `.rodata.str1.1' 不能在制作共享对象时使用;使用 -fPIC /usr/bin/ld 重新编译:最终链接失败:输出 collect2 上的不可表示部分:错误:ld 返回 1 退出状态错误:命令“gcc -pthread -shared -L/opt/rh/rh-python36/root/ usr/lib64-Wl,-z,relro -Wl,-rpath,/opt/rh/rh-python36/root/usr/lib64 -Wl,--enable-new-dtags build/temp.linux-x86_64-3.6/ pyhdf/hdfext_wrap.o -L/usr/local/hdf4/lib -L/usr/local/jpeg/lib -L/usr/local/zlib/lib -L/usr/local/jpeg/lib -L/usr/ local/zlib/lib -L/usr/local/szip/lib -L/usr/lib -L/usr/local/lib -L/lib -L/opt/rh/rh-python36/root/usr/lib64 - lmfhdf -ldf -ljpeg -lz -lpython3.6m -o build/lib.linux-x86_64-3.6/pyhdf/_hdfext。

0 投票
1 回答
45 浏览

python - 无法构建 pyhdf

我一直在尝试安装 pyhdf,但是收到此错误消息,我似乎无法找到解决方案。

我无法解释虚线之前的段落是什么意思。我尝试过的方法包括升级pip、升级pip setuptools wheel、安装PEP517、安装gcc。任何帮助将不胜感激!

编辑:使用的命令是 pip install pyhdf

谢谢!

0 投票
0 回答
19 浏览

python-3.x - 下载带有请求 session.get() 的文件并将结果直接传递给 PyHDF 而不接触磁盘?

现在,我的 Python 3 脚本从 NASA 的 GES DISC(数千个)下载 50MB .hdf 文件,将它们写入磁盘,将它们读回,然后选择并保存文件中大约 2% 的数据。显然,如果它只保存 2% 的数据并且从不将整个文件写入磁盘,它将最大限度地减少磁盘读写。

注意:requests除非您有免费的Earthdata用户名/密码,否则此示例将不起作用

现在 .hdf 文件在内存中,典型的下一步是写入磁盘:

然后再读一遍:

跳过磁盘写入/读取并执行以下操作将是理想的:

但这会引发错误:HDF4Error: SD: no such file
有没有办法在不接触磁盘的情况下将 r.content 传递给 PyHDF?