Re: Modify variable by longitude

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Oct 21 2009 - 21:50:42 MDT

I was just answering 'on the fly' ... try the 'where' function

si_new = where(lon_1d.ge.-134 .and. lon_1d.le.169 \
               , ...whatever..., si)

Brandon Fisel wrote:
> Dennis,
>
> This returns the following error:
>
> fatal:Conditional statements (if and do while) require SCALAR logical
> values, see all and any functions
>
>
> -------------------------------------------------------------
> Brandon Fisel
>
>
> On Wed, Oct 21, 2009 at 21:51, Dennis Shea <shea@ucar.edu
> <mailto:shea@ucar.edu>> wrote:
>
> See addfile doc
> http://www.ncl.ucar.edu/Document/Functions/Built-in/addfile.shtml
>
> Use the "w" option.
> I suggest making a copy of the original file ... "just in case"
>
> f = addfile("met_em.d01.1998-03-20_12.nc
> <http://met_em.d01.1998-03-20_12.nc>", "w")
> si = f->SEAICE ; SEAICE(Time, south_north, west_east)
>
> lon = f->XLONG_M
> lat = f->XLAT_M
>
> si_1d = ndtooned( si )
> lon_1d = ndtooned( lon )
> lat_1d = ndtooned( lat )
>
> if (lon_1d.ge.-134 .and. lon_1d.le.169) then
> si_new = ....
> end if
> si_new = onedtond(si_1d, dimsizes(si) )
>
> f->SEAICE = (/ si_new /)
>
>
> Brandon Fisel wrote:
>
> Hi NCL'ers,
>
> I'm attempting to read in all the variables from a met_em.d01
> file and write all of them to a new met_em.d01 file with the
> exception of a variable, SEAICE, which will need to be modified
> before being written to the new file.
>
> The variable, SEAICE, contains data between 0.0 - 1.0. The
> constraints are that the variable will not need to be changed
> between longitudes (-135 - -179) and (170 - 179). The negative
> longitudes are West and positive longitudes are East. The
> remainder longitudes (-134 - 0 & 0 - 169) will need to be
> modified for values between 0-0.49 and 0.50-1.
>
> Attached are the contents of the met_em.d01 file.
>
> -------------------------------------------------------------
> Brandon Fisel
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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 Oct 21 21:50:39 2009

This archive was generated by hypermail 2.1.8 : Fri Oct 23 2009 - 11:36:30 MDT