Menu

ncrename fails when output file is specified

Help
pmunhutu
2012-02-29
2013-10-17
  • pmunhutu

    pmunhutu - 2012-02-29

    ncrename fails when output file is specified and input file has read only permissions. ncrename preserves permissions of input file

    netcdf ocean_daily__0002_002_classic_reduced {
    dimensions:
            Time = UNLIMITED ; // (31 currently)
            yh = 1952 ;
            xh = 2880 ;
    variables:
            float SSS(Time, yh, xh) ;
                    SSS:long_name = "Sea Surface Salinity" ;
                    SSS:units = "PSU" ;
                    SSS:cell_methods = "time: point" ;
            float SST(Time, yh, xh) ;
                    SST:long_name = "Sea Surface Temperature" ;
                    SST:units = "Celsius" ;
                    SST:cell_methods = "time: point" ;
            double Time(Time) ;
                    Time:long_name = "Time" ;
                    Time:units = "days since 0001-01-01 00:00:00" ;
                    Time:cartesian_axis = "T" ;
                    Time:calendar_type = "NOLEAP" ;
                    Time:calendar = "NOLEAP" ;
            float xh(xh) ;
                    xh:long_name = "h point nominal longitude" ;
                    xh:units = "degrees_E" ;
                    xh:cartesian_axis = "X" ;
            float yh(yh) ;
                    yh:long_name = "h point nominal latitude" ;
                    yh:units = "degrees_N" ;
                    yh:cartesian_axis = "Y" ;

    // global attributes:
                    :filename = "ocean_daily__0002_002.nc" ;
                    :title = "HiRes_0125" ;
                    :grid_type = "regular" ;
                    :grid_tile = "N/A" ;
                    :history = "Wed Jun  2 18:36:14 2010: ncks -v SST,SSS ocean_daily__0002_002_classic.nc ocean_daily__0002_002_classic_reduced.nc\n",
                            "Fri May 28 13:06:06 2010: ncks -3 /net/pem/Matlab/aja_tests/analysis/ocean_daily__0002_002.nc ocean_daily__0002_002_classic.nc" ;
    }

    ncrename -D 5 -v SST,paida_SST ocean_daily__0002_002_classic_reduced.nc ocean_daily__0002_002_classic_reduced_ncrename_bug.nc
    Copying ocean_daily__0002_002_classic_reduced.nc to ocean_daily__0002_002_classic_reduced_ncrename_bug.nc…done
    nco_err_exit(): ERROR Short NCO-generated message (usually name of function that triggered error): nco_open()
    nco_err_exit(): ERROR Error code is 13. Translation into English with nc_strerror(13) is "Permission denied"
    nco_err_exit(): ERROR NCO will now exit with system call exit(EXIT_FAILURE)

    ncrename -r
    NCO netCDF Operators version "4.0.8" last modified 2011/04/12 built Oct 24 2011 on ppam1.princeton.rdhpcs.noaa.gov by root
    ncrename version 4.0.8
    Linked to netCDF library version 4.1.1, compiled Oct 24 2011 11:54:04
    Copyright (C) 1995-2011 Charlie Zender
    NCO is free software and comes with A BIG FAT KISS and ABOLUTELY NO WARRANTY
    License: GNU General Public License (GPL) Version 3
    Homepage: http://nco.sf.net
    User's Guide: http://nco.sf.net/nco.html
    Configuration Option:   Active? Meaning or Reference:
    Check _FillValue        Yes     http://nco.sf.net/nco.html#mss_val
    Check missing_value     No      http://nco.sf.net/nco.html#mss_val
    Compressed netCDF3      No      http://nco.sf.net/nco.html#znetcdf (pre-alpha)
    DAP clients (libdap)    No      http://nco.sf.net/nco.html#dap
    DAP clients (libnetcdf) Yes     http://nco.sf.net/nco.html#dap
    Debugging: Custom       No      Pedantic, bounds checking (slowest execution)
    Debugging: Symbols      No      Produce symbols for debuggers (e.g., dbx, gdb)
    GNU Scientific Library  Yes     http://nco.sf.net/nco.html#gsl
    Internationalization    No      http://nco.sf.net/nco.html#i18n (pre-alpha)
    MPI parallelization     No      http://nco.sf.net/nco.html#mpi (beta)
    netCDF3 64-bit files    Yes     http://nco.sf.net/nco.html#lfs
    netCDF4/HDF5            Yes     http://nco.sf.net/nco.html#nco4
    OpenMP SMP threading    No      http://nco.sf.net/nco.html#omp
    Optimization: run-time  No      Fastest execution possible (slowest compilation)
    Parallel netCDF3        No      http://nco.sf.net/nco.html#pnetcdf (pre-alpha)
    Shared libraries built  Yes     Small, dynamically linked executables
    Static libraries built  Yes     Large executables with private namespaces
    UDUnits conversions     No      http://nco.sf.net/nco.html#udunits
    UDUnits2 conversions    Yes     http://nco.sf.net/nco.html#udunits
    Wildcarding (regex)     Yes     http://nco.sf.net/nco.html#rx

    Mirage & Glade

    Regards,
    Paida

     
  • Charlie Zender

    Charlie Zender - 2012-02-29

    Aaah. I never thought of that but it makes sense. ncrename copies the input file then operates on that so if the input is read-only it will fail. Thanks for pointing this out. Just committed temporary fix… will improve it later.
    cz

     
  • Charlie Zender

    Charlie Zender - 2012-02-29

    there is now a robust fix for this in the repository. there is probably an equivalent bug in ncatted which i hope to fix in the next few days.
    cz

     
  • pmunhutu

    pmunhutu - 2012-03-06

    Hi Zender,

    Great, I am not sure if other tools other than the two we have identified may have the bug. Thanks for the fix, can we look forward to it in the next version?

    Regards,
    Paida

     
  • Charlie Zender

    Charlie Zender - 2012-03-06

    yes. ncrename and ncatted are the only affected operators. they are both fixed in the repository and the fix will be in the next release.
    cz

     

Log in to post a comment.