Menu

updated to 4.9.7 and mro is not working

Help
John
2026-01-14
2026-01-22
  • John

    John - 2026-01-14

    We just updated NCO to 4.9.7 and mro is not working correctly.

    ncra --mro -d time,,,12,12 in.nc out.nc
    

    The command runs but out.nc has only 1 time slice, the average of all the time slices (and the value of the average is correct). I'm really hoping to use the per_record_weights option offered by 4.9.7! How could we troubleshoot this?

    Is the input file somehow not structured right? It looks like this:

    netcdf in {
    dimensions:
        lat = 1 ;
        lon = 1 ;
        time = UNLIMITED ; // (1140 currently)
    variables:
        double lat(lat) ;
           // snip
        double lon(lon) ;
          // snip
    double time(time) ;
            time:units = "days since 1900-01-01 00:00:00" ;
            time:long_name = "time" ;
            time:calendar = "standard" ;
            time:missing_value = 1.00000001504747e+30 ;
            time:bounds = "time_bnds" ;
            time:axis = "T" ;
            time:standard_name = "time" ;
            time:cell_methods = "time: mean" ;
        float tmin(time, lat, lon) ;
            tmin:_FillValue = 1.e+30f ;
            tmin:missing_value = 1.00000001504747e+30 ;
            tmin:units = "K" ;
    }
    

    Returning from a hiatus... so am feeling a little rusty. Thank you.

     
  • John

    John - 2026-01-22

    Found a workaround after a lot of voodoo!

    First, I discovered that mro works OK on some of my files. So I compared the metadata of the working & non-working files and could not find any difference. I also tried extracting smaller slabs and -- weirdly -- some of the small slabs worked with mro and some didn't.

    I then tried running "ncra --mro" with the debug flag "-D 3", and compared the debug info between the working and non-working files. With the non-working file, debug info showed all the input time slices going into one output time slice, but it did not hint at the cause.

    Finally, I tried exporting a small slab (for which mro did not work) into cdl and re-create an nc file from that using ncgen, and mro worked on the resulting file! That gave me the idea that something must be corrupt in my nc file. So I ran "ncks -3" on the file to convert it to netcdf3, thinking not so much that the version is important, but having NCO write the file out itself is important. Then I ran "ncra --mro" on the resulting file, and it's working. Phew!

    Just documenting in case others run into a similar problem.

     
  • Charlie Zender

    Charlie Zender - 2026-01-22

    Thanks for the input. NCO 5.1.9 had a fix to --mro that might help your use-case. I suggest updating to the latest stable version, 5.3.6.

     
    👍
    1

Log in to post a comment.

MongoDB Logo MongoDB
Gen AI apps are built with MongoDB Atlas
Atlas offers built-in vector search and global availability across 125+ regions. Start building AI apps faster, all in one place.