NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

[netcdfgroup] easy/quick way to get attribute value from shell?

Is there an easy and quick way to *get* the value of an attribute
(whether global or variable) from a (bash) shell commandline or
script? AFAICS

* NCO's `ncatted` will allow one to *set* an attribute value, but is
  write-only.

* R package=ncdf4 will allow one to get an attribute value, but
  requires loading R, plus writing a fair bit of code.

Am I missing something? Currently, unless I need to run R for other
reasons, I'm writing bash like

  if [[ "$(ncdump -h ${F} | fgrep -e ${OUTPUT_VAR_NAME}:units)" =~ 
"${OUTPUT_VAR_UNITS}" ]] ; then
    echo -e 'output!'
  fi

which is not as robust as I'd like.

TIA, Tom Roche <Tom_Roche@xxxxxxxxx>



  • 2012 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: