Leon noted that netcdf Fortran versions 4.2 through 4.5.3 have an issue with character arrays, and he provided a patch to nf_fortv2.f90 that needs to be applied to fix this so that the latest version of netcdf will work properly with the madis library. Have you been able to take a look at incorporating that yet? Leon also noted that, when compiled, the later versions of netcdf still need to support V2 Fortran calls for madis interoperability.
On Fri, Oct 1, 2021 at 4:43 PM Leon Benjamin - NOAA Affiliate <[leon.a.benjamin@noaa.gov](mailto:leon.a.benjamin@noaa.gov)> wrote:
Jeff,
I talked to Greg about the help ticket getting into my court.
I'm assuming you are using netcdf c 4.7.4 with netcdf fortran 4.5.3 (or close to it)
netcdf fortran 4.2 to 4.5.3 has a problem with char arrays, it only returns the first one, not all of them.
MADIS station ids are char arrays.
My developer found a fix by changing nf_fortv2.f90. What he did was:
The guts of the code for nf_get_vara_text look almost identical
to that for ncvgtc (id calls nc_get_vara_text instead of c_ncvgtc),
so I don't know what the magic is that converts C style string
arrays to Fortran style.
Anyway, I thought I'd try to replace the guts of ncvgtc with a
simple call direct to nf_get_vara_text, as that's basically all
I did in my previous test code... and it worked:
I've attached the nf_fortv2.f90 that we are using and that I added to github
Jeff, you mention in the email that you have a test program that demonstrates this problem, Can you cut and past the fortran code into this issue and I will turn it into a test for the netcdf-fortran repo?
Leon, your fix for nf_fortv2.f90 got lost in my copy of the email chain where I learned of this. Can you please cut and paste the changed function into this issue? Sounds like the changes are confined to just one function. Otherwise attach the file to this issue (you may have to rename it to *.txt to get it accepted by github).
From Jeff Ator:
Jeff, you mention in the email that you have a test program that demonstrates this problem, Can you cut and past the fortran code into this issue and I will turn it into a test for the netcdf-fortran repo?
Leon, your fix for nf_fortv2.f90 got lost in my copy of the email chain where I learned of this. Can you please cut and paste the changed function into this issue? Sounds like the changes are confined to just one function. Otherwise attach the file to this issue (you may have to rename it to *.txt to get it accepted by github).