# Re: Setting Mexico data to _FillValue

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Thu, 28 May 2009 08:42:18 -0600

There is no built-in way to set values over specific
countries to _FillValue.

You did not specify if your lat/lon are one-dimensional
or multidimensional.

Let's say x(time,lat,lon),

if lat[*], lon[*]

LAT = conform(x, lat, 1) ; LAT(time,lat,lon)
LON = conform(x, lon, 2) ; LON(time,lat,lon)

or, if lat[*][*], lon[*][*]

LAT = conform(x, lat, (/1,2/)) ; LAT(time,lat,lon)
LON = conform(x, lon, (/1,2/)) ; LON(time,lat,lon)

then use 'where'

x = where(LAT.lt.25, x@_FillValue, x)
x = where(LAT.lt.31 .and. LON.lt.-106.5, x@_FillValue, x)

delete(LAT)
delete(LON)

It is likely you will have to refine the above but you get the idea.

Good luck

Eric D. Robinson wrote:
> I have data that covers most of CONUS and part of the ocean, Canada, and
> Mexico. I would like to set all the data that is not over the CONUS to
> _FillValue. but I can't find an efficient way to do this. I know I can
> set the ocean data to _FillValue with the mask function since I have the
> land/sea mask, but I do not have a similar data set for political
> boundaries. Any suggestions would be appreciated. Thanks!
>
> -Eric
>
> _______________________________________________
> 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 Thu May 28 2009 - 08:42:18 MDT

This archive was generated by hypermail 2.2.0 : Mon Jun 01 2009 - 07:47:28 MDT