我在处理从CCMP_Wind_Analysis_yyyymmdd_V02.0_L3.0_RSS.nc下载的风分析时遇到了问题。
NetCDF fortran库使用所提供的示例代码成功地打开了气候学,但没有打开单独的每日数据。
program open
USE netcdf
IMPLICIT NONE
INTEGER(KIND=4) :: ierr !Open netCDF file
ierr=nf90_open(path='infile', mode=nf90_nowrite, ncid=ncid)
ierr=nf90_close(ncid)
end program open它回来了
error code -51, "NetCDF: Unknown file format "失败的文件似乎是由Matlab创建的,它的版本是netcffd-4经典模型
$ ncdump -k Data/CCMP/200408/CCMP_Wind_Analysis_20040801_V02.0_L3.0_RSS.nc
$ netCDF-4 classic model气候学是由IDL创建的,它的版本也很简单
$ ncdump -k Data/CCMP/CCMP_Wind_Analysis_climatology_V02.0_L3.5_RSS.nc
$ classic每日数据和气候学数据都可以由ncdump或grads来打开,但是我想二进制地转储每日数据,如果我可以使用fortran,速度会更快。
有人知道为什么和如何解决这个问题吗?
提前谢谢。
发布于 2022-04-19 17:50:53
您的Fortran代码很可能链接到netCDF经典库,而不是netCDF4库。netCDF4库将产生类似于以下对nf-config的响应
zender@spectral:~$ nf-config
This 4.5.3 has been built with the following features:
--cc -> clang
--cflags -> -I/opt/homebrew/Cellar/netcdf/4.8.1_1/include -fPIC -g -Wall -Wno-unused-variable -Wno-unused-parameter -O2
--fc -> /opt/homebrew/bin/gfortran
--fflags -> -I/opt/homebrew/Cellar/netcdf/4.8.1_1/include -I/opt/homebrew/Cellar/netcdf/4.8.1_1/include
--flibs -> -L/opt/homebrew/Cellar/netcdf/4.8.1_1/lib -lnetcdff -lnetcdf
--has-f90 -> TRUE
--has-f03 -> yes
--has-nc2 -> yes
--has-nc4 -> yes
--prefix -> /opt/homebrew/Cellar/netcdf/4.8.1_1
--includedir-> /opt/homebrew/Cellar/netcdf/4.8.1_1/include
--version -> 4.5.3
zender@spectral:~$ 确保--has-nc4 -> yes而不是-> no。
https://stackoverflow.com/questions/71918478
复制相似问题