[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: