1

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.

iyui
  • 31
  • 4
  • 1
    I'm not a netcdf expert, but if I understand the output of `man ncdump` correctly "classic" and "netCDF-4 classic model" are not the same thing. Can you tell us the version of the netcdf library you are linking against? – Ian Bush Apr 19 '22 at 13:06
  • you are correct. And netcdf-3.6.2 that I was using did not support netCDF-4 classic model. Installing the latest library solved the problem. Thank you! – iyui Apr 27 '22 at 00:50

1 Answers1

2

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.

Charlie Zender
  • 5,929
  • 14
  • 19
  • The one I was using was a netcdf-3.6.2. I installed the latest netcdf fortran library with NetCDF4 enabled and it worked! Thank you! – iyui Apr 27 '22 at 00:49