Attached is a C program that hacks into a NetCDF file and changes the number of records in the file header. Compile command: gcc hack_numrecs.c -o hack_numrecs Run command: ./hack_numrecs prod.nc 14 Please backup your input file first. I tested it against file, prod.nc, by changing the number of records to 14 and verified the updated file with the utility program named 'ncvalidator'. It appears to me the only problem of the original prod.nc is the wrong number of records in the file header. Wei-keng On Feb 4, 2022, at 8:51 AM, Ramakrishnan N <ram.n.krishnan@xxxxxxxxx<mailto:ram.n.krishnan@xxxxxxxxx>> wrote: I have a netcdf file (prod.nc<https://urldefense.com/v3/__http://prod.nc__;!!Dq0X2DkFhyF93HkjWTBQKhk!FK2mESqDdiPm0bi9x3pxACU8dfAUrVQrXaTHKWSRfp5xONugHQH7flIruBbX7k-Hkz6Y$>) that contains time series from a molecular dynamics simulation (Amber force field, OpenMM engine, parmed netCDFReporter). The netCDFReporter had some problems and as a result, the number of frames in the netcdf file is zero. Given below is the ncdump for the file: $ncdump -h prod.nc<https://urldefense.com/v3/__http://prod.nc__;!!Dq0X2DkFhyF93HkjWTBQKhk!FK2mESqDdiPm0bi9x3pxACU8dfAUrVQrXaTHKWSRfp5xONugHQH7flIruBbX7k-Hkz6Y$> netcdf prod { dimensions: frame = UNLIMITED ; // (0 currently) spatial = 3 ; atom = 20504 ; variables: char spatial(spatial) ; float time(frame) ; time:units = "picosecond" ; float coordinates(frame, atom, spatial) ; coordinates:units = "angstrom" ; // global attributes: :Conventions = "AMBER" ; :ConventionVersion = "1.0" ; :application = "AmberTools" ; :program = "ParmEd" ; :programVersion = "3.4.0+11.g1be8ca0f" ; :title = "ParmEd-created trajectory" ; } However, the netcdf file has non-zero size (that increases linearly with the number of frames stored) which implies that it certainly has the data written into it. I tried a number of tools (nco tools, netCDF4, scipy netcdf reader, xarray) to access the missing data but have not succeeded. I have two questions: 1. Does the file contain real data? 2. If the former, is there a way to retrieve the data and create a new netcdf file? I am desperately looking to salvage near 3 microseconds of simulation data which would take more than 2 months to generate. I would greatly appreciate it if anyone can provide me with some insight into this problem. The attached netcdf file has 14 frames that can be used to examine the issue. Thanks in advance Best Ram <prod.nc>_______________________________________________ NOTE: All exchanges posted to Unidata maintained email lists are recorded in the Unidata inquiry tracking system and made publicly available through the web. Users who post to any of the lists we maintain are reminded to remove any personal information that they do not want to be made public. netcdfgroup mailing list netcdfgroup@xxxxxxxxxxxxxxxx<mailto:netcdfgroup@xxxxxxxxxxxxxxxx> For list information or to unsubscribe, visit: https://urldefense.com/v3/__https://www.unidata.ucar.edu/mailing_lists/__;!!Dq0X2DkFhyF93HkjWTBQKhk!FK2mESqDdiPm0bi9x3pxACU8dfAUrVQrXaTHKWSRfp5xONugHQH7flIruBbX7peWmZi7$
Attachment:
hack_numrecs.c
Description: hack_numrecs.c
netcdfgroup
archives: