Re: Outputting Multiple NARR files to ascii text

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue, 14 Jul 2009 10:30:48 -0600 (MDT)

Hi,

I apologize for getting to this late. I don't have a lot of time, so
I quickly looked line 28 of your script where it said the problem is.

The error is:

  fatal:Number of subscripts on rhs do not match number of dimensions of
  segregated cat type variable, (2) subscripts used, (3) Subscripts
  expected
  fatal:Execute: Error occurred at or near line 28 in file grib_ascii.ncl

It's basically saying that you are trying to treat the variable
as if it is two-dimensional, when actually it is 3-dimensional.

You need a third dimension, probably a leftmost dimension
that represents the record dimension:

  invar2 = f[:]->V_GRD_221_HTGL_113(:,0:130,144)

The above will grab all of the leftmost elements. If you just want one,
say the first one:

  invar2 = f[:]->V_GRD_221_HTGL_113(0,0:130,144)

I'm sorry I don't have time to go into more detail on this. Hopefully
it will help you get past this.

--Mary

On Thu, 9 Jul 2009, DJ Rasmussen wrote:

>
>>
>> NCL support team,
>>
>> I am struggling to be able to read in only one grid point and one
>> level from several NARR .grb files with u and v wind data, have
>> NCL(version 5.1.1) compute the magnitude of the wind, then output the
>> wind magnitude for each file to a 1-D matrix in a single ascii text
>> file. I have played with the/ addfiles_GetVar/ function, but it does
>> not seem to help solve my situation. I think my problem might be how
>> I am calling in one specific grid point and level from all the files.
>> I apologize, but I have very little NCL and coding experience as I am
>> an undergrad doing research for a professor.
>>
>> The errors I get is:
>>
>> fatal:Number of subscripts on rhs do not match number of dimensions of
>> segregated cat type variable, (2) subscripts used, (3) Subscripts
>> expected
>> fatal:Execute: Error occurred at or near line 28 in file grib_ascii.ncl
>>
>> Any help from the NCL community would be greatly appreciated
>>
>> Regards,
>>
>> DMR
>>
>>
>>
>> ;*************************************************
>> ; grib_ascii.ncl
>> ;************************************************
>> 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"
>>
>> ;************************************************
>> begin
>>
>> ;************************************************
>> ; read in grib files
>> ;************************************************
>> diri = "/home/rasmussen/NARCCAP/NARR/grib/" ; directory where files
>> reside
>> fils = systemfunc("ls "+diri+"*.grb") ; call in all .grb files in
>> the folder
>> print("opening input "+fils)
>> f = addfiles(fils,"r") ; read all files
>>
>> ListSetType(f, "cat")
>>
>> ;For u component:
>>
>> invar=f[:]->U_GRD_221_HTGL_113(0:130,144); take in only this grid
>> point and level from all files
>>
>> invar!0="lv_HTGL3" ; output the data from grid points and place in 1-D
>> matrix
>>
>> ;For v component:
>>
>> invar2=f[:]->V_GRD_221_HTGL_113(0:130,144)
>>
>> invar2!0="lv_HTGL3"
>>
>>
>> wspd=sqrt(invar*invar+invar2*invar2) ; compute wind speeds from each
>> u,v component in the NARR files
>>
>>
>> ;************************************************
>> ; output ascii
>> ;************************************************
>> fName = "narr_wspd.txt"
>>
>> asciiwrite (fName , wspd) ; write wind speeds to text file in a list
>> form/ 1-D matrix
>>
>> end
>>
>>
>
> --
>
> DJ Rasmussen
>
> Antarctic Meteorological Research Center
>
> University of Wisconsin - Madison Space Science and Engineering Center
>
> 1225 W. Dayton St., Rm 947, Madison, WI 53706
>
> Email: dj.rasmussen_at_ssec.wisc.edu
>
> http://amrc.ssec.wisc.edu
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jul 14 2009 - 10:30:48 MDT

This archive was generated by hypermail 2.2.0 : Fri Jul 17 2009 - 15:27:02 MDT