Re: wind speed

From: Vishali P. <vishali.prat_at_nyahnyahspammersnyahnyah>
Date: Mon Sep 27 2010 - 05:52:11 MDT

I've tried to use the first method to output of netCDF only for the first
year (1998). But I found an error.
This is my script

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

;*************************************************
; wind.ncl (1998)
;************************************************
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
;************************************************
begin
;************************************************
; read in netCDF file
;************************************************

  a = addfile("/home/Vishali/Documents/dadosVentos/uwnd.1998.nc","r")
  print(a)
  b = addfile("/home/Vishali/Documents/dadosVentos/vwnd.1998.nc","r")

;************************************************
; read in zonal [u] and meridional [v] winds
;************************************************

  u = short2flt(a->uwnd(:,:,:,:))
  v = short2flt(b->vwnd(:,:,:,:))

  printVarSummary(u)
  printVarSummary(v)

;************************************************
; Calculate Wind speed
;************************************************

  speed = sqrt(u^2+v^2) ; wind speed magnitude

  copy_VarMeta(u, speed)

  speed@long_name = "wind speed"

  printVarSummary(speed)

;************************************************
; Create netCDF output
;************************************************

  system("/bin/rm -f wind1998.nc") ; remove any pre-existing
file
  ncdf = addfile("wind1998.nc" ,"c") ; open output netCDF
file

 ; make time and UNLIMITED dimension ; recommended for most
applications
  filedimdef(ncdf,"time",-1,True)

 ; output variables directly
  ncdf->u = u ; 4D
  ncdf->v = v ; 4D

  speed!0 = "time"
  speed!1 = "level"
  speed!2 = "lat"
  speed!3 = "lon" ; assign named dimensions

  speed&time = u&time
  speed&level= u&level
  speed&lat = u&lat ; copy variables from u
to speed
  speed&lon = u&lon

  speed@long_name = "Wind Speed" ; assign attributes of
speed
  speed@units = "m/s"

  ncdf->WSpeed = speed

end

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

fatal:NclMalloc Failed:[errno=12]
fatal:Could not coerce values for operation
fatal:Execute: Error occurred at or near line 1488 in file
$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl

fatal:Execute: Error occurred at or near line 23 in file Wind.ncl

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Can anyone help me to solve the problem?

Thanks in advance

Vp

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Sep 27 05:52:18 2010

This archive was generated by hypermail 2.1.8 : Mon Oct 04 2010 - 08:55:55 MDT