Answer to question 2
delete all used array and use them again
Yongzuo
Today's Topics:
1. gridding GOES data (Scott Capps)
2. fatal:Dimension size mismatch, dimension (1) of left hand
side reference does not have the same size as the right hand side
reference after subscripting. fatal:Execute: Error occurred at or
near line 229 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/d
(Sabeerali(sebi))
----------------------------------------------------------------------
Message: 1
Date: Fri, 8 Jan 2010 17:21:04 -0800
From: Scott Capps <scapps@atmos.ucla.edu>
Subject: gridding GOES data
To: ncl-talk@ucar.edu
Message-ID: <3B703BE1-3D58-43AE-BCB4-9299CD45C8BF@atmos.ucla.edu>
Content-Type: text/plain; charset=us-ascii
Greetings,
I am gridding a 2-D GOES dataset (not gridded) onto a fine grid: 0.01x0.01 degree using the natgrids function. The natgrids function runs forever on datasets larger than ~8MB. I must be missing something, here is my script. Any help is appreciated.
; BEGIN SCRIPT
; USAGE: ncl 'obs_yr=2010' 'dd_of_yr=3' 'dd_in_yr=365' 'filenm1="/data/scapps/goes/goes11.2010.003.200014.BAND_01.nc"' 'fl_out="test.nc"' goes_grid.ncl
;
begin
file1 = addfile(filenm1,"r")
bright = file1->data(0,:,:) ; float data(bands, lines, elems)
brite1d = ndtooned(bright)
delete(bright)
lat = file1->latitude(:,:) ; float latitude(lines,elems)
lon = file1->longitude(:,:) ; float longitude(lines,elems)
lat1d = ndtooned(lat)
lon1d = ndtooned(lon)
delete(lon)
delete(file1)
delete(lat)
; Create Regular Grid
dlon = 1./100. ;0.01 degree
dlat = 1./100. ;0.01 degree
lat1 = decimalPlaces(flt2dble(min(lat1d)),2,True)
lat2 = decimalPlaces(flt2dble(max(lat1d)),2,True)
lon1 = decimalPlaces(flt2dble(min(lon1d)),2,True)
lon2 = decimalPlaces(flt2dble(max(lon1d)),2,True)
nlon = doubletoint(abs(lon1-lon2)/dlon)+1
nlat = doubletoint(abs(lat1-lat2)/dlat)+1
londbl = fspan(lon1,lon2,nlon)
latdbl = fspan(lat1,lat2,nlat)
lat_out= doubletofloat(latdbl)
lon_out= doubletofloat(londbl)
delete(londbl)
delete(latdbl)
nnsetp("ext", 0) ;interp NOT allowed outside convex hull
nnsetp("non", 1) ;interp values are NOT allowed to be negative
nnsetp("nul",-999.0) ;Set _FillValue
;**************************************************************
; INTERP USING NATGRID:http://www.ncl.ucar.edu/Document/Functions/Built-in/natgrid.shtml
tmp1_int = natgrids(lon1d, lat1d, brite1d, lon_out, lat_out) ; Outputs as lon,lat
;**************************************************************
tmp1_int!0 = "lon"
tmp1_int!1 = "lat"
tmp1_int&lon = lon_out
tmp1_int&lat = lat_out
out1_int = tmp1_int(lat | :,lon | :)
delete(tmp1_int)
; Writeout to netCDF file...
------------------------------
Message: 2
Date: Sun, 10 Jan 2010 00:16:58 +0530
From: "Sabeerali(sebi)" <sabeerl@gmail.com>
Subject: fatal:Dimension size mismatch, dimension (1) of
left hand side reference does not have the same size as the right hand
side reference after subscripting. fatal:Execute: Error occurred at or
near line 229 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/d
To: ncl-talk@ucar.edu, ncl-talk-request <ncl-talk-request@ucar.edu>
Message-ID:
<4792511f1001091046p6f8ef938uf5c0175bf89ac89d@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Dear all,
When I tried to calculate the frequency wavenumber spectra by using the
below script I am getting the following errors.
fatal:Dimension size mismatch, dimension (1) of left hand side reference
does not have the same size as the right hand side reference after
subscripting.
fatal:Execute: Error occurred at or near line 229 in file
$NCARG_ROOT/lib/ncarg/nclscripts/csm/diagnostics_cam.ncl
fatal:Execute: Error occurred at or near line 2910 in file
$NCARG_ROOT/lib/ncarg/nclscripts/csm/diagnostics_cam.ncl
fatal:Execute: Error occurred at or near line 60 in file mjoclivar_10.ncl
Any help would be appreciated,
Thanking you
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/diagnostics_cam.ncl"
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
begin
; time window
twStrt = 20020102
twLast = 20341231
diri = "/home/sebi/convert/"
vName = "daily_preci" ; name of variable on the file
fili = "daily_preci.nc"
f = addfile(diri+fili, "r")
pltDir = "./"
pltType = "pdf"
pltName = "t61_wave_freq"
;************************************************************
; time indices corresponding to the desired time window
;************************************************************
date = f->time
iStrt = ind(date.eq.twStrt) ; desired dates
iLast = ind(date.eq.twLast)
delete(date)
;************************************************************
; Read user specified period
;************************************************************
if (getfilevartypes(f,vName) .eq. "short") then
X = short2flt( f->$vName$(iStrt:iLast,{-10:40},{50:150}) ) ; all data
in window
else
X = f->$vName$(iStrt:iLast,{-10:40},{50:150})
end if
printVarSummary( X )
printMinMax(X, True)
time = X&time ; clarity
; date = ut_calendar( time , -2 ) ; yyyymmdd
date=time
;************************************************************
x = dim_avg_Wrap( X(time|:,lon|:,lat|:) ) ; (time,lon)
;************************************************************
; calculate and plot the spectra
;************************************************************
optWavFrq = False
optPlot = TrueoptPlot@smth9 = False
nameSeason = (/"winter" , "summer"/)
do ns=0,dimsizes(nameSeason)-1
wf = mjo_wavenum_freq_season (x, date,nameSeason(ns), optWavFrq)
optPlot@tiMainString ="Wave no:- Freq: spectra: "+ nameSeason(ns)+":
"+twStrt+"-"+twLast
mjo_wavenum_freq_season_plot (wf, nameSeason(ns), pltDir, pltType,
pltName, optPlot)
end do
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20100110/f13fbac7/attachment.html
------------------------------
_______________________________________________
ncl-talk mailing list
ncl-talk@ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
End of ncl-talk Digest, Vol 74, Issue 23
****************************************
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat Jan 9 12:21:55 2010
This archive was generated by hypermail 2.1.8 : Tue Jan 12 2010 - 15:38:20 MST