[ncl-talk] Extracting temperature from specific grids where LU_INDEX = 2

Imran Hosen hosen.imran09 at gmail.com
Tue Mar 14 03:06:30 MDT 2017


Dear Guido and Barry,

Thank you so much for your heartfelt and prompt response. Yes, your
suggestions are working fine for my script.

Guido, your assumption is absolutely right. According your suggestion I
wrote the script as follows:

T2 = f_1->T2(:,:,:)
LU_INDEX = f_1->LU_INDEX(0,:,:)       ; (LU_INDEX = landuse index)
T2_masked = mask(T2,(LU_INDEX.eq.2), True)
T2_masked at _FillValue = -9999
print(T2_masked)

The script works fine and it is extracting both real values and FillValues
(missing values). *But, I want to extract only real values*. I have seen
that "*ind*" function can be used for extracting real values for
*one-dimensional
array*. Could you please suggest me what function I can use to extract the
real values for *two-dimensional array*.

Your further suggestion will be highly appreciated.

Kind regards,
Imran


On Tue, Mar 14, 2017 at 6:55 PM, Guido Cioni <guidocioni at gmail.com> wrote:

> Hi Imran,
> unfortunately I’m not really an expert of WRF, so I’m going to give you a
> general hint which may work. You should be more precise next time as
> generally people do not know what is LU_INDEX and what is its structure ;)
>
> I assume that you want to extract temperature, which is 3-D (time, lat,
> lon) using a mask array LU_INDEX which is 2-D (lat, lon). Again, if this
> assumption is wrong please be more specific. You have many choices, but I
> believe that for the sake of clarity you may want to go for an array which
> has the same dimensions but missing values where LU_INDEX is not 2. So you
> may want to do something like this:
>
> T2_masked=mask(T2, LU_INDEX.ne.2, False).
>
> You need to have a Missing Value attribute set for the T2 variable of
> course. As a result you will get an array with the same dimensions, so that
> it’s easier to compare with the original one, but with Missing Values where
> your condition is False, so that for every computation these points will
> not be considered. You can achieve something similar with the where
> function. Please have a look here (http://www.ncl.ucar.edu/
> Document/Functions/Built-in/mask.shtml).
>
> Cheers
>
>
> Il giorno 14 mar 2017, alle ore 04:38, Imran Hosen <
> hosen.imran09 at gmail.com> ha scritto:
>
> Dear NCL users,
>
> Good day!
>
> I'm a new user of NCL. I want to extract temperature (T2) from wrfout file
> for the specific grid points where the LU_INDEX = 2.
>
> For example,
> f = addfile("./wrfout.nc)
> T2 = f->T2(:,:,:)
>
> It will extract temperature for whole domain for all time steps. In my
> case, I only want to extract temperature for all time steps but for the
> specific grids which grids represent LU_INDEX = 2.
>
> Could you please suggest how to do it. I would grateful to you if anyone
> please share a script.
>
> Thanks in advance.
>
> Kind regards,
> Imran
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>


-- 
*Md. Imran Hosen*
PhD Student
Victoria University
College of Engineering and Science
Footscray Park Campus
Victoria, Australia
Mob. +61470371562
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170314/2564e7f3/attachment.html 


More information about the ncl-talk mailing list