Re: Masking Tibetan Plateau

From: Rob Nicholas <rnicholas_at_nyahnyahspammersnyahnyah>
Date: Sat Apr 10 2010 - 17:16:11 MDT

Hi Louis,

Here's one way to do it. Let's assume you have files *z850.nc* and *
z_surface.nc* each containing a single, identically named variable. Both
have dimensions [lat][lon][time] and are on the same grid, but *z850.nc* has
an arbitrary number of timesteps while *z_surface.nc* has only one timestep.
 The mask file can then be created using CDO with a single line of code:

     cdo setrtoc,-1.e9,0,0 -setrtoc,0,1.e9,1 -sub z_surface.nc -timpctl,5
z850.nc -timmin z850.nc -timmax z850.nc mask850.nc

Or, broken down into multiple steps to show the process more clearly:

     cdo timpctl,5 z850.nc -timmin z850.nc -timmax z850.nc z850_5th_pctl.nc
     cdo sub z_surface.nc z850_5th_pctl.nc diff.nc
     cdo setrtoc,-1.e9,0,0 -setrtoc,0,1.e9,1 diff.nc mask850.nc
     rm z850_5th_pctl.nc diff.nc

You can then use the mask you've created with NCL's mask() function. I don't
think it would be a big deal to replicate this wholly within NCL, but CDO is
so blazingly fast (the above took less than 2 seconds on my laptop when
applied to 60 years of monthly reanalysis data) and NCL seems to lack a
function for computing percentiles, so it would be a bit more work. You
could, of course, execute CDO from within NCL using the system() procedure
if you like to keep everything in one place.

~Rob

On Sat, Apr 10, 2010 at 1:28 AM, louis Vonder <appopson@yahoo.fr> wrote:
>
> Hi Rob,
> Can you share your CDO code with us?
> Louis
> Regards
>
> --- En date de : Ven 9.4.10, Rob Nicholas <rnicholas@atmos.washington.edu>
a écrit :
>
> De: Rob Nicholas <rnicholas@atmos.washington.edu>
> Objet: Re: [ncl-talk] Masking Tibetan Plateau
> À: ncl-talk@ucar.edu
> Date: Vendredi 9 avril 2010, 19h26
>
> Hi A.R.,
>
> Others may have better ways to do this, but I'll share what I've done
> and hope that others will chime in to correct/improve the method I'm
> outlining.
>
> What I did was use the surface geopotential and the 850 mb heights
> from NCEP/NCAR Reanalysis to create a mask. The tricky part about
> masking out topography for fields on pressure levels, of course, is
> this fact that geopotential height of the pressure levels change with
> time. First I found 5th percentile* of 850 mb geopotential height for
> each gridbox over the entire reanalysis period. Any gridbox where the
> surface geopotential equalled or exceeded this value was set to 0; all
> other gridboxes were set to 1. Then apply this masking array to the
> 850 mb wind data using the NCL mask() function.
>
> I'm not going to suggest any specific NCL code (I used CDO for this
> particular task) but I think the above could be done in just a few
> lines.
>
> ~Rob
>
> * The "5th percentile" choice is really quite arbitrary, but I chose
> it because using the minimum value for each gridbox ended up masking
> out vast swaths of the globe to the point of making the fields useless
> for my purpose.
>
>
>
> On Thu, Apr 8, 2010 at 9:04 PM, A.R Ragi <ar.ragi@gmail.com> wrote:
> > Dear NCL users..,
> >
> > I would like to know is there any way to mask the Tibetan Plateau while
> > plotting 850hpa winds in NCL??
> >
> > --
> > *********************************************************************
> > Thanks,
> > A.R.Ragi
> > M.Tech Atmospheric science
> > Department of Atmospheric science
> > Cochin University of Science and Technology
> > Email : ar.ragi@gmail.com
> >
> > ***********************************************************************
> > "I want to know how God created this world.I am not interested in this
or
> > that phenomenon. I want to know, his thought, the rest are details" .
> > ---Albert Einstein
> >
> > ***********************************************************************
> >
> >
> > _______________________________________________
> > 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
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat Apr 10 17:17:15 2010

This archive was generated by hypermail 2.1.8 : Wed Apr 14 2010 - 09:15:22 MDT