Re: masking the CCSM T42 output with a shape file

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri Mar 26 2010 - 15:27:23 MDT

Sanjiv,

I'm not sure what you mean by "mask the CCSM3 T43 outputs". Do you
mean you only want to
do *calculations* over areas of your grid that are not part of the
Missippippi River Basin, or do
you want to *graphically* mask out the area that is the Missippippi
River Basin?

There's no way in NCL to provide a lat/lon boundary and say "do the
calculations only on the part of
the grid that falls within this boundary". In a situation like this,
you would generally need a separate
"mask" array that conrtains 0s and 1s indicating where your data is
inside or outside a particular area.

One thing people have done is to set the areas in the grid that they
are not interested in to
data@_FillValue (missing value). This will only work if the functions
you plan to use know
how to handle missing data.

To get your data grid filled with missing values in the area you're
not interested in, see the
"gc_inout" function:

   http://www.ncl.ucar.edu/Document/Functions/Built-in/gc_inout.shtml

Note that this can be slow if you have a lot of points in your basin,
which you do. And,
this will provide an approximate area only.

I've attached a sample NCL script that creates a dummy (small) array.
I then use gc_inout
to mask out the dummy array that is *not* the MRB (maybe you want the
opposite of this).

I draw the full data contours on the first frame, the masked data
contours on the second,
and the lat/lon grid over the masked area in the third.

[Note: I'm used the new "png" option that will be available in V5.2.0
to gsn_open_wks to create these png images.]

--Mary

On Mar 26, 2010, at 1:35 PM, Sanjiv Kumar wrote:

> Mary,
>
> Thank you for the reply.
>
> I did go through that example. This example does not seem
> sufficient for my problem.
>
> I will try to make my question more clear:
>
> I want to mask the CCSM3 T42 outputs with the Mississippi River
> Basin shape (MRB) file. I am attaching the MRB shape file here.
>
> So the question is: processing the climate model output for the
> given shape.
>
> Sanjiv
>
>
>
> On Thu, Mar 25, 2010 at 10:13 AM, Mary Haley <haley@ucar.edu> wrote:
> Sanjiv,
>
> If you have V5.1.1, we have support for reading shapefiles via
> "addfile".
>
> See:
>
> http://www.ncl.ucar.edu/Applications/shapefiles.shtml
>
> for some examples.
>
> Let me know if this is not enough information.
>
> --Mary
>
>
> On Mar 25, 2010, at 7:16 AM, Sanjiv Kumar wrote:
>
> Hello,
>
> I want to process the output from CCSM T42 runs for the Mississippi
> River Basin (MRB). I have a shape file for the MRB.
>
> I was wondering whether this can be done with ncl or not.
>
> Thanks
>
> Sanjiv
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
> <mrb.zip>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Mar 26 15:28:50 2010

This archive was generated by hypermail 2.1.8 : Sat Mar 27 2010 - 07:18:15 MDT