[ncl-talk] Problem with wkSpaceTime_3.ncl - Dimension size mismatch in diagnosctics_cam.ncl
Dennis Shea
shea at ucar.edu
Thu Apr 5 22:38:43 MDT 2018
Hello,
re: "The dimension numbering in the "resolveWavesHayashi" part of
diagnostics_cam.ncl confuses me a little bit"
I wrote this a long time ago and it confuses me also. :-)
===
diagnostics_cam.ncl
===
232 dimvf = dimsizes( varfft )
233 mlon = dimvf(1)
234 N = dimvf(2)
235
236 varspacetime = new((/2,mlon+1,N+1/),typeof(varfft),1e20)
237
238 varspacetime(:,:mlon/2-1,:N/2-1) = varfft(:,mlon/2:1,N/2:N-1)
239 varspacetime(:,:mlon/2-1,N/2:) = varfft(:,mlon/2:1,:N/2)
240 varspacetime(:, mlon/2: ,:N/2) = varfft(:,:mlon/2,N/2:0) ;
<===========
241 varspacetime(:, mlon/2: ,N/2+1:) = varfft(:,:mlon/2,N-1:N/2)
----------
730 ;-------------------------------------------------------------------
731 ; At this point 'q(2,mlon,nSampWin)' contains the
732 ; real and imaginary space-time spectrum for this latitude
733 ; ---
734 ; Use Hayashi method to resolve into Progressive [Eastward]
735 ; and Retrogressive [Westward] Waves.
736 ;-------------------------------------------------------------------
737
738 pee = resolveWavesHayashi( q, nDayWin, spd ) ; <============
739 peeAS(nl,:,:) = peeAS(nl,:,:) + (pee/nWindow) ; sum window
contribution
---------
Basically, lines 238,241 are unscrambling what was returned from an FFT
done in fortran 'under-the-hood.'
---
I see one thing that is an issue.
The variable includes the cyclic point in the zonal [longitudinal]
direction. When an FFT is performed on a cyclic series the cyclic point
should *not* be included. Including the cyclic point results in an odd
number of points (799) which would likely lead to some index problems. All
global data sets 'we' use have an even number of grid points in the zonal
direction.
Variable: x (parameter)
..
Number of Dimensions: 3
Dimensions and sizes: [Time | 282] x [lat | 66] x *[lon | 799]*
Coordinates:
lat: [-14.675..14.575]
*lon: [-179.55..179.55]*
I speculate that if you use:
*MLON = 799 ; includes cyclic point*
*mlon = MLON-1*
olr2 = file_list[:]->OLR(:,:,*0:mlon-1*)
printVarSummary(olr2) ; Time | 282] x [lat | 66] x *[lon
| 798]*
The script will work
NCL indexing is described her:
https://www.ncl.ucar.edu/Document/Manuals/Ref_Manual/NclVariables.shtml#Subscripts
Good luck
D
On Thu, Apr 5, 2018 at 5:30 AM, Thomas Schwitalla <
thomas.schwitalla at uni-hohenheim.de> wrote:
> Hello,
>
> I try to run the wkSpaceTime_3.ncl script with NCL 6.4 with OLR from WRF
> output files. I have a time series of 141 days with 12h intervals.
> When running the script, the output is the following:
>
> Variable: x (parameter)
> Type: float
> Total Size: 59483952 bytes
> 14870988 values
> Number of Dimensions: 3
> Dimensions and sizes: [Time | 282] x [lat | 66] x [lon | 799]
> Coordinates:
> lat: [-14.675..14.575]
> lon: [-179.55..179.55]
> Number Of Attributes: 6
> coordinates : XLONG XLAT XTIME
> stagger :
> units : W m-2
> description : TOA OUTGOING LONG WAVE
> MemoryOrder : XY
> FieldType : 104
> (0)
> (0) TOA OUTGOING LONG WAVE (W m-2) : min=66.8377 max=392.351
> (0) ===> Post removal of trend and signal <===
>
> Variable: x (parameter)
> Type: float
> Total Size: 59483952 bytes
> 14870988 values
> Number of Dimensions: 3
> Dimensions and sizes: [Time | 282] x [lat | 66] x [lon | 799]
> Coordinates:
> lat: [-14.675..14.575]
> lon: [-179.55..179.55]
> Number Of Attributes: 6
> coordinates : XLONG XLAT XTIME
> stagger :
> units : W m-2
> description : TOA OUTGOING LONG WAVE
> MemoryOrder : XY
> FieldType : 104
> (0)
> (0) TOA OUTGOING LONG WAVE (W m-2) : min=14.4336 max=390.484
>
> Variable: xAS
> Type: float
> Total Size: 59483952 bytes
> 14870988 values
> Number of Dimensions: 3
> Dimensions and sizes: [lat | 66] x [lon | 799] x [Time | 282]
> Coordinates:
> lat: [-14.675..14.575]
> lon: [-179.55..179.55]
> Number Of Attributes: 2
> long_name : antisymmetric & symmetric (separate hemispheres)
> units : W m-2
> (0)
> (0) antisymmetric & symmetric (separate hemispheres) (W m-2) :
> min=-139.037 max=366.622
> (0) ==============> nl=0 <==============
> (0) nw=0 ntStrt=0 ntLast=191
>
> 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.c":8640]:Execute: Error occurred at or near line 240 in
> file $NCARG_ROOT/lib/ncarg/nclscripts/csm/diagnostics_cam.ncl
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 738 in
> file $NCARG_ROOT/lib/ncarg/nclscripts/csm/diagnostics_cam.ncl
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 54 in
> file wk_space_time3.ncl
>
> My script is the following:
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/diagnostics_cam.ncl"
>
> case = "TEST"
> diro = "./" ; output dir: location of plots
>
> latN = 15
> latS = -latN ; symmetric about the equator
>
> nDayWin = 96 ; Wheeler-Kiladis [WK] temporal window length (days)
> nDaySkip = -10 ; time (days) between temporal windows [segments]
> ; negative means there will be overlapping
> ; temporal segments
> opt = True
> opt at debug= True
> opt at pltType = "eps"
> opt at cnLinesOn = False ; turn off contour lines
> ; specify the plot intervals
> spd = 2 ; samples per day (12 hour sampling rate for testing)
> var = "OLR" ; user specified
> all_files = systemfunc ("ls surface_d01_2015-02-[12]?_0[0]_00_00
> surface_d01_2015-02-[12]?_1[2]_00_00 surface_d01_2015-0[3456]-??_0[0]_00_00
> surface_d01_2015-0[3456]-??_1[2]_00_00")
>
> ;---Open files using addfiles
> file_list = addfiles (all_files, "r")
>
> ;---Read "pottmp" in "join" mode and print a summary of the variable
> ListSetType (file_list, "cat")
>
> olr2 = file_list[:]->OLR(:,:,:)
> single_file = systemfunc ("ls LAT_LON_50km.nc")
> coordinates_file = addfile(single_file,"r")
> longitude = coordinates_file->XLONG(0,0,:)
> latitude= coordinates_file->XLAT(0,:,0)
>
> olr2!1 = "lat"
> olr2!2 = "lon"
> olr2&lat = latitude
> olr2&lon = longitude
> olr = olr2(:,{latS:latN},:) ; (time,lat,lon)
> delete(olr2)
> ; calculation and create plots
> wkSpaceTime (olr, diro, case, var \
> ,latN, spd, nDayWin, nDaySkip, opt )
>
> The dimension numbering in the "resolveWavesHayashi" part of
> diagnostics_cam.ncl confuses me a little bit.
>
> Regards,
>
> Thomas
>
> --
> Dr. Thomas Schwitalla
> Institute of Physics and Meteorology
> University of Hohenheim
> Garbenstrasse 30
> 70599 Stuttgart
> Germany
> Tel.: +49 711 459 22145
>
> _______________________________________________
> ncl-talk mailing list
> 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/20180405/50a7c4e7/attachment.html>
More information about the ncl-talk
mailing list