NETCDF FORTRAN未能以NETCDF文件为单位hdf nf90_open

发布于 2025-01-22 07:13:49 字数 843 浏览 6 评论 0原文

与风分析有关CCMP_WIND_ANALYSIS__YYYYMMDD_V02.0_L3.0_RSS.NC从FTP.SSMI.com下载。

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创建的,它的版本是NetCDF-4经典模型

$ ncdump -k Data/CCMP/200408/CCMP_Wind_Analysis_20040801_V02.0_L3.0_RSS.nc
$ netCDF-4 classic model

,气候是由IDL创建的,它的版本是Clasic,

$ ncdump -k Data/CCMP/CCMP_Wind_Analysis_climatology_V02.0_L3.5_RSS.nc
$ classic

每天和气候数据都可以由NCDUMP或GRADS打开,但我想二进制dump。每日数据,如果我可以使用fortran,则会更快。

有人知道为什么以及如何解决它吗?

提前致谢。

I am having a problem dealing with wind analysis CCMP_Wind_Analysis_yyyymmdd_V02.0_L3.0_RSS.nc downloaded from ftp.ssmi.com.

NetCDF fortran library successfully opened the climatology but not the individual daily data with the provided sample code.

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

It returned

error code -51, "NetCDF: Unknown file format "

The failed file seems created by Matlab and it's version was netCDF-4 classic model

$ ncdump -k Data/CCMP/200408/CCMP_Wind_Analysis_20040801_V02.0_L3.0_RSS.nc
$ netCDF-4 classic model

and climatology was created by IDL and it's version was clasic

$ ncdump -k Data/CCMP/CCMP_Wind_Analysis_climatology_V02.0_L3.5_RSS.nc
$ classic

The both daily and climatology data can be opened by ncdump or by grads, but I want to binary dump the daily data and it's much faster if I can use fortran.

Does anyone know why and how it can be solved?

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦一生花开无言 2025-01-29 07:13:49

您的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 - >是不是- >否

It seems most likely that your Fortran code is linked to a netCDF classic library, not a netCDF4 library. A netCDF4 library will produce something like the following response to 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:~$ 

Make sure that --has-nc4 -> yes not -> no.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文