Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with character arrays in V2 API with nf_fortv2.f90 patches #408

Open
edwardhartnett opened this issue Aug 3, 2023 · 0 comments
Open
Milestone

Comments

@edwardhartnett
Copy link
Contributor

edwardhartnett commented Aug 3, 2023

From Jeff Ator:

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 <[[email protected]](mailto:[email protected])> 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).

@WardF WardF added this to the 4.6.2 milestone Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants