ufs-community / UFS_UTILS

Utilities for the NCEP models.
Other
21 stars 104 forks source link

Incorrect use of optional parameters in nf90_create call in chgres_cube.fd/write_data.F90 #307

Closed edwardhartnett closed 1 year ago

edwardhartnett commented 3 years ago

in chgres_cube.fd/write_data.F90 we have:

error = nf90_create(outfile, IOR(NF90_NETCDF4,NF90_CLASSIC_MODEL), &
                     ncid, initialsize=initial, chunksize=fsize)

I need to doublecheck but I'm pretty sure that the initialsize and chunksize parameters are only used for classic files, and are ignored for netcdf4 files. So they should be removed.

GeorgeGayno-NOAA commented 1 year ago

This will be addressed in #689.

edwardhartnett commented 1 year ago

Correct: initialsize and chunksize in nf90_create() are holdovers from attempts to make classic files perform better. I don't think they really help much in any case, but certainly with NETCDF4 files they are not needed and will simply be ignored.

The chunksize here is not to be confused with the HDF5 chunksizes that netCDF-4 supports. The HDF5 chunksizes are set on a per-variable basis, and are multi-dimensional, with dimensions that match the variable. For example, a 3D variable needs 3 chunksizes, a 5D variable needs 5.

In netCDF-4 files, chunksizes can be optimized for faster reading and writing. If you don't select chunksizes for a variable, then netCDF picks them for you, doing the best it can.

LarissaReames-NOAA commented 1 year ago

@edwardhartnett Can we close this issue now that #704 is merged?

edwardhartnett commented 1 year ago

Yes!