question about .D file converting to netCDF

97 views
Skip to first unread message

zoj john

unread,
Jun 28, 2020, 12:26:28 PM6/28/20
to HYCOM.org Forum
Hello,I have already run Make_all.csh and Make_ncdf.csh in /hycom-tools/force/src.And after that,when I run nrl2nc executable file,it gives me the message that ERROR IN ZHOPEN -  CAN'T OPEN UNIT 71. 
I'd appreciate it if you could help me.Thanks.

Alan Wallcraft

unread,
Jun 29, 2020, 9:41:00 AM6/29/20
to HYCOM.org Forum, 9574...@qq.com
There is a tar bundle of example scripts at https://www.hycom.org/tools/309-forcing-to-netcdf-converter

The setenv FOR071 line (unit 71 input) identifies the .D file.

The examples are for monthly fields, and instantaneous fields would use T_BOUNDS = 0.0,0.0.

There are comments in nrl2nc.f describing the NAMELIST options.

Alan.

zoj john

unread,
Jun 30, 2020, 1:50:48 AM6/30/20
to HYCOM.org Forum, 9574...@qq.com
Thanks for your prompt reply.But when I run the C shell,it gives me the message that 
horout - title=NVGM 2.0 0.176c 2020 3h dswsfc, als ct
          WRITING RECORD    1     FDAY = 43556.00   FDATE =20200401.0000

error in profout - from NetCDF library
nf90_put_var-pLonVarID

NetCDF: Start+count exceeds dimension bound

Warning: ieee_inexact is signaling

I don't know why this error happened,and I will appreciate it if you could help me.

在 2020年6月29日星期一 UTC+8下午9:41:00,Alan Wallcraft写道:

yuluot...@gmail.com

unread,
Jun 30, 2020, 7:01:23 AM6/30/20
to HYCOM.org Forum, 9574...@qq.com
I also have this kind of problem, how to setenv FOR071, can you explain which specific file setting or operation? thank you!


在 2020年6月29日星期一 UTC+8下午9:41:00,Alan Wallcraft写道:
There is a tar bundle of example scripts at https://www.hycom.org/tools/309-forcing-to-netcdf-converter

Alan Wallcraft

unread,
Jun 30, 2020, 10:00:34 AM6/30/20
to HYCOM.org Forum, yuluot...@gmail.com, 9574...@qq.com
The attached script is an example of how to use nrl2nc.  The nrl2nc.f program includes comments on the NAMELIST options, some of which depend on the input field's characteristics.

The input .D file is on Fortran unit 71, which is identified by environment variable FOR071:

setenv W        navgem2.0_0.176c-std_2020_03hr
#
setenv FOR071   ${W}_wndspd.D

Alan.
nrl2nc_wndspd.csh

Alan Wallcraft

unread,
Jun 30, 2020, 10:27:28 AM6/30/20
to HYCOM.org Forum, 9574...@qq.com
I suspect a mismatch between the netcdf fortran module (.mod) and the linked library.

The command nc-config reports on what compile and link options are needed, for example:

COAPS 133> nc-config --libs
-L/usr/lib64 -lnetcdf
COAPS 134> nc-config --flibs
-lnetcdff
COAPS 135> nc-config --fflags
-I/usr/include
COAPS 137> which nc-config
/usr/bin/nc-config

The Make_ncdf.csh script copies the .mod files into the current directory:

#
# --- softlink to netCDF module and library
#
/bin/rm -f netcdf.mod libnetcdf.a libnetcdff.a
/bin/rm -f netcdf.inc
/bin/rm -f typesizes.mod
#
ln -s ${NCDFC}/lib/libnetcdf.a .
ln -s ${NCDF}/lib/libnetcdff.a .
ln -s ${NCDF}/include/netcdf.mod .
ln -s ${NCDF}/include/netcdf.inc .
ln -s ${NCDF}/include/typesizes.mod .

This is a holdover from when it was difficult to get .mod and .a files right on the command line.

One work around is to define dummy NCDF and NCDFC in HTCOM-tools/Make_ncdf.src:

#
# --- Generic system with netcdf in system library, dummy NCDF and NCDFC
setenv NCDFC     ${HOME}/HYCOM-tools/lib
setenv NCDF      ${HOME}/HYCOM-tools/lib
setenv EXTRANCDF "-lnetcdf -lnetcdff"

COAPS 189> pwd
/home/awallcraft/HYCOM-tools/force/src
COAPS 190> ll *.mod
-rw-r--r--. 1 awallcraft awallcraft 8313 Dec  9  2019 mod_scrip.mod
-rw-r--r--. 1 awallcraft awallcraft  713 Dec  9  2019 mod_xc.mod
-rw-r--r--. 1 awallcraft awallcraft 1572 Dec  9  2019 mod_za.mod
lrwxrwxrwx. 1 awallcraft awallcraft   51 Dec  9  2019 netcdf.mod -> /home/awallcraft/HYCOM-tools/lib/include/netcdf.mod
lrwxrwxrwx. 1 awallcraft awallcraft   54 Dec  9  2019 typesizes.mod -> /home/awallcraft/HYCOM-tools/lib/include/typesizes.mod

Where netcdf.mod and typesizes.mod softlinks fail.

But then you need the right compile and link options in your Make_all.src config file:

For example:

FC            = gfortran
FCFFLAGS      = -g -fPIC -m64 -fno-second-underscore -fconvert=big-endian -O -I/usr/include -I/usr/lib64/gfortran/modules

In this case netcdf.mod is in  /usr/lib64/gfortran/modules

You can start by just removing nrl2nc.o and nrl2nc and remaking in the force.src directory.  If your new setup works, clean everything and rebuild HYCOM-tools.

Alan.
Reply all
Reply to author
Forward
0 new messages