Module: NumRu::NetCDF_Convention_Wind_Profiler

Extended by:
NetCDF_Convention_Users_Guide
Defined in:
lib/numru/gphys/netcdf_convention.rb

Defined Under Namespace

Modules: Attribute_Mixin, VArray_Mixin

Class Method Summary collapse

Methods included from NetCDF_Convention_Users_Guide

assoc_coord_names, cell_bounds?, cell_center?

Class Method Details

.aux_var_names(coord_var) ⇒ Object



402
403
404
# File 'lib/numru/gphys/netcdf_convention.rb', line 402

def aux_var_names(coord_var)
  Hash['coordinate', coord_var.dim_names[0] ]
end

.coord_var_names(ncvar) ⇒ Object



367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
# File 'lib/numru/gphys/netcdf_convention.rb', line 367

def coord_var_names(ncvar)
  if (c=ncvar.att('coordinates'))
  coordinates = c.get.split(/ +/)
  elsif (ct=ncvar.att('t_coordinates')) || (cz=ncvar.att('z_coordinates'))
  coordinates = Array.new
  coordinates.push(ct.get) if ct
  coordinates.push(cz.get) if cz
  else
  coordinates = nil
  end
  dimnames = ncvar.dim_names 
  if coordinates
  cdvnames = []
  coordinates.each{ |varname|
    var = ncvar.file.var(varname)
    raise "#{var.inspect} is not 1D" unless var.rank==1
      dimnm = var.dim(0).name
    idx = dimnames.index(dimnm)
    if idx
 cdvnames[idx] = varname
    else
 raise "#{varname} cannot be a coordinate variable -- "+
          "#{ncvar.file.path} not comply with the Wind Profiler convention"
    end
  }
  for i in 0...dimnames.length
    cdvnames[i] = dimnames[i] if !cdvnames[i]  #if not found, use dimname
  end
  cdvnames
  else
  # follow the users guide convention
  dimnames
  end
end

.to_sObject



363
364
365
# File 'lib/numru/gphys/netcdf_convention.rb', line 363

def to_s
  "Wind Profiler (http://www.kurasc.kyoto-u.ac.jp/radar-group/wind_profiler_conventions/)"
end