Opened 4 years ago

Last modified 4 years ago

#276 accepted Defect

Problems creating NetCDf output with many output levels

Reported by: rrigby Owned by: ignacio
Priority: minor Milestone: FLEXPART 10
Component: FP coding/compilation Version: FLEXPART 10.4
Keywords: Cc:

Description

When doing some FLEXPART test runs with many output levels, the jobs would fail quite quickly when creating the NetCDF output file, e.g.:

 NetCDF: Invalid argument
Stopped

When testing, this error seemed to occur with more than 20 output levels, or thereabouts.

I had a look at the NetCDF writing / creation code, and the attached patch seems to have fixed things for us, which mostly just removes the specific values for the chunk sizes, so default values are used.

I'm sure other approaches/ fixes would be possible as well.

I thought it might be of interest, and was worth letting you know.

Thanks and all the best,

Richard

Attachments (1)

netcdf_output_mod.f90.patch (3.4 KB) - added by rrigby 4 years ago.

Download all attachments as: .zip

Change History (4)

Changed 4 years ago by rrigby

comment:1 Changed 4 years ago by pesei

  • Component changed from FP other to FP coding/compilation
  • Milestone set to FLEXPART 10
  • Summary changed from Problmes creating NetCDf output with many output levels to Problems creating NetCDf output with many output levels

Thank you for letting us know. I am not a netCDF specialst and personally use it. Could you please give some background, how you found that the compression level and chunksize was the problem?

Version 0, edited 4 years ago by pesei (next)

comment:2 Changed 4 years ago by rrigby

Thanks for taking a look.

Honestly, I didn't investigate thoroughly, but realised that the problem seemed to be with NetCDF creation, so just removed the custom options for cache_size and chunk size, so that the defaults would be used.

The patch also includes an altered deflate_level, but that's just down to preference.

I have just been investigating a bit more ...

The cache_size is set in netcdf_output_mod.f90 at:

312   cache_size = 16 * nnx * nny * numzgrid

In an example which causes problems, the output grid dimensions are 3600 * 1800 * 25, so the cache_size_value would be:

16 * 3600 * 1800 * 25 = 2592000000

cache_size is a 4 byte integer, so this value exceeds the largest value which can be stored.

Testing with changing cache_size to an 8 byte integer means that the cache_size value is set correctly in FLEXPART, but the same problem still occurs, as I'm guessing cache_size is also a 4 byte integer in the NetCDF libraries.

If the cache_size option is removed from nf90_create(), then the NetCDF file is created, and things appear to run.

The output NetCDF file seems to be readable, though, Panoply does seem to have issues plotting the data.

Where the chunk size value is set for the species concentration output variables:

479   chunksizes = (/ nnx, nny, numzgrid, 1, 1, 1 /)

changing this to:

chunksizes = (/ nnx, nny, 1, 1, 1, 1 /)

seems to produce output files which are also readable by Panoply.

As it requires large (unusually large?) output grid dimensions to trigger the issue, I would completely understand if you were happy to leave things as they are.

When the code was written, some thought was obviously put in to choosing suitable cache and chunk sizes, and we are happy to patch for local needs.

Hope that's all of some use.

Thanks again,

Richard

comment:3 Changed 4 years ago by ignacio

  • Owner set to ignacio
  • Status changed from new to accepted
Note: See TracTickets for help on using tickets.
hosted by ZAMG