[ncl-talk] Attributes

Muhammad Omer Mughal m.mughal1 at postgrad.curtin.edu.au
Thu Dec 8 21:25:35 MST 2016


Hi Dennis


Thanks


Muhammad Omer Mughal
MSc BSc Mechanical Engineering
PhD  Research Scholar
Remote Sensing and Satellite Research Group
Department of Imaging and Applied Physics
Curtin University

Curtin University
Tel | +61 8 9266 7962
Fax | +61 8 9266 2377
Mobile | 0470 237 525

Email | m.mughal1 at postgrad.curtin.edu.au<mailto:m.lynch at curtin.edu.au>
Web | http://curtin.edu.au<http://curtin.edu.au/>

Curtin University is a trademark of Curtin University of Technology.
CRICOS Provider Code 00301J (WA), 02637B (NSW)


________________________________
From: Dennis Shea <shea at ucar.edu>
Sent: Friday, 9 December 2016 12:09:06 PM
To: Muhammad Omer Mughal
Cc: ncl-talk at ucar.edu
Subject: Re: [ncl-talk] Attributes

Please read the documentation at (say):
    http://www.ncl.ucar.edu/Document/Manuals/

Mini-Language Manual
or the
DKRZ Tutorial

Look at the @ for attribute
==============================
   f = addfile("uv300.nc<http://uv300.nc>","r")
   TITLE = f at title
or
   title  = f at title
or
   foo = f at title

==========================


netcdf uv300 {
dimensions:
        lat = 64 ;
        lon = 128 ;
        time = 2 ;
variables:
        float lat(lat) ;
                lat:short_name = "lat" ;
                lat:long_name = "latitude" ;
                lat:units = "degrees_north" ;
        float lon(lon) ;
                lon:units = "degrees_east" ;
                lon:long_name = "longitude" ;
                lon:short_name = "lon" ;
        float gw(lat) ;
                gw:long_name = "gaussian weights" ;
                gw:short_name = "gws" ;
                gw:units = "dimensionless" ;
        int time(time) ;
                time:long_name = "Month of Year" ;
                time:short_name = "Mo" ;
                time:units = "month" ;
        float U(time, lat, lon) ;
                U:_FillValue = -999.f ;
                U:long_name = "Zonal Wind" ;
                U:short_name = "U" ;
                U:units = "m/s" ;
        float V(time, lat, lon) ;
                V:_FillValue = -999.f ;
                V:long_name = "Meridional Wind" ;
                V:short_name = "V" ;
                V:units = "m/s" ;

// global attributes:
                :title = "UV300: January and July" ;
                :source = "Climate Analysis Section, NCAR" ;
                :history = "Dataset uv300.hs from EZPLOT demo dataset" ;
                :Conventions = "None" ;
                :creation_date = "Mon Mar 29 09:24:57 MST 1999" ;
                :references = "\n",
                        "EZPLOT for Publication Quality Plots\n",
                        "Christian Guillemot\n",
                        "NCAR-TN 414   1995\n",
                        "http://www.cgd.ucar.edu/cas/ezplot/" ;

On Thu, Dec 8, 2016 at 8:59 PM, Muhammad Omer Mughal <m.mughal1 at postgrad.curtin.edu.au<mailto:m.mughal1 at postgrad.curtin.edu.au>> wrote:

Hi


This example pulls the global attributes off a file and prints out their values:

  f = addfile("$NCARG_ROOT/lib/ncarg/data/cdf/uv300.nc<http://uv300.nc>","r")

  file_atts = getvaratts(f)

  print(file_atts)

  if(.not.any(ismissing(file_atts))) then
    do i=0,dimsizes(file_atts)-1
      print("Attribute " + file_atts(i) + " = " + f@$file_atts(i)$)
   end do
  end if


How can one pull out a specific attribute from the file f  and use it ?



Muhammad Omer Mughal
MSc BSc Mechanical Engineering
PhD  Research Scholar
Remote Sensing and Satellite Research Group
Department of Imaging and Applied Physics
Curtin University

Curtin University
Tel | +61 8 9266 7962
Fax | +61 8 9266 2377
Mobile | 0470 237 525

Email | m.mughal1 at postgrad.curtin.edu.au<mailto:m.lynch at curtin.edu.au>
Web | http://curtin.edu.au<http://curtin.edu.au/>

Curtin University is a trademark of Curtin University of Technology.
CRICOS Provider Code 00301J (WA), 02637B (NSW)



_______________________________________________
ncl-talk mailing list
ncl-talk at ucar.edu<mailto:ncl-talk at ucar.edu>
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20161209/c539f701/attachment.html 


More information about the ncl-talk mailing list