Re: Fwd: Error from using "where" function

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Apr 11 2012 - 07:50:47 MDT

[1] The syntax you used is incorrect. Further, the
     shapes of the arrays in your statement are inconsistent.

[2] If the sst array has one-dimensional coordinate variables, use

     sst(:,{latS:latN},{lonW:lonE}) = 0

If you are new to NCL, please read the mini-language manual at

    http://www.ncl.ucar.edu/Document/Manuals/

Good Luck

On 4/11/12 1:51 AM, Jingmin Li wrote:
> Hello, Here is me again.
>
> My code below at the line with where function should be :
>
> sst= where( (sst@lat.ge.latS .and. sst@lat.le.latN .and. \
> sst@lon.ge.lonW .and. sst@lon.le.lonE),0,sst)
>
> Sorry for my mistake. Please have a look what is the problem!
> Thanks.
> Jingmin
>
> ----- Forwarded message from jingmin.li@uni-tuebingen.de -----
> Date: Wed, 11 Apr 2012 09:26:00 +0200
> From: Jingmin Li<jingmin.li@uni-tuebingen.de>
> Subject: Error from using "where" function
> To: ncl-talk@ucar.edu
>
> Hello,
>
> I have a 3-dimensional array coordinate arrays time*lon*lat. I want to
> set all values outside a domain region to 0.
>
> I copied one example of "where" function from NCL home. But I got
> always error message like:
> --------------------
> fatal:And: Dimension size, for dimension number 0, of operands does
> not match, can't continue)
> fatal:where: condition variable (parameter 1) dimension mismatch with
> parameter 2.
> -----------------------
>
> Does anyone know what is the problem? Thanks!
> Jingmin
>
> Here is my code:
> ---------------------
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>
> begin
>
> data_dir = "/home/jingmin/echam_plot"
> cdf_file = addfile(data_dir + "/T21_amip2sst_2000_copy.nc","r")
>
> sst = cdf_file->sst ; files to local variables.
> sst@time = cdf_file->time
> sst@lat = cdf_file->lat ; Create coordinate variables
> sst@lon = cdf_file->lon ; for sst and store the sizes
>
> latS = 30.00
> latN = 40.00
> lonW = 70.00
> lonE = 140.00
>
> sst= where( (sst@lat.ge.latS .and. sst@lat.le.latN .and. \
> sst@lon.ge.lonW .and. sst@lonE),0,sst)
> end
> ----------------------------------
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
> ----- End forwarded message -----
>
> _______________________________________________
> 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 Wed Apr 11 07:50:57 2012

This archive was generated by hypermail 2.1.8 : Fri Apr 13 2012 - 13:37:52 MDT