NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hi all, I’m having an issue with using netcdf with fortran – I have several netcdf files that need to be read into a fortran program and some of the variables in the netcdf files have null datasets. E.g. doing an ncdump operation as follows: $> ncdump –v hello hello_world.nc Will output hello = _ ; To the terminal because the dataset associated with it is null. Even though it is null, I need it to still be read in in the FORTRAN code because the code will be performing operations on several netcdf files – and in some of them, the variable “hello” has actual values. Currently in the FORTRAN code, I’m currently doing the following: - Allocating an array big enough to hold the “hello” dataset. - Performing an NF90_get_var operation as follows: o Err = NF90_GET_VAR(ncid, 10, helloArray) o Where ncid is the id for the file, 10 is the variable ID, and helloArray is the location where the data needs to be stored. - Writing the array to the screen The last step, writing the array to the screen, currently produces garbage, I assume that it is the memory address – a random negative number completely unrelated to the value (null) in the ncdump output. Is there a way to check for nulls using the netcdf API? At the moment I can’t think of a way to do this and therefore my data gathering from the netcdf file is not accurate. A work flow as follows would be appropriate: - Allocate an array big enough - Perform NF90_get_var operation - Check if the result obtained with null - Deal with it appropriately. Look forward to hearing people’s thoughts on this! Cheers -- Sent from: http://netcdf-group.1586084.n2.nabble.com/
netcdfgroup
archives: