Re: ncl-talk Digest, Vol 128, Issue 1

From: Saurabh Singh <saurabhsingh123op_at_nyahnyahspammersnyahnyah>
Date: Tue Jul 01 2014 - 12:45:13 MDT

NCL VERSION : 6.1
OS:ubuntu 13.04

Dear sir

I have a problem while extracting time series data from FNL (grib1) data

if i just try with a single file i get my desired output

;*****************************************************

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"

grib_file="/home/cee1/Desktop/200202/fnl_20020201_00_00.grb"
fin = addfile(grib_file,"r")
x= fin->R_H_3_EATM(2,103)
asciiwrite("rh8.txt",x)


i get output as "35". that is correct

but if i tried with multiple inputs

i tried the code

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
files = systemfunc("ls -1 /home/cee1/Desktop/200202/fnl_2002*") + ".grb"
a = addfiles(files,"r")
x= a->R_H_3_EATM(2,103)
asciiwrite("rh8.txt",x)


to extract relative humidty bu i get the following NCL error :

fatal:Variable (x) is undefined
fatal:["Execute.c":7743]:Execute: Error occurred at or near line 8 in file
fnl.ncl

please help me how to get results with multipl input.


On Wed, Jul 2, 2014 at 2:00 AM, <ncl-talk-request@ucar.edu> wrote:

> Send ncl-talk mailing list submissions to
> ncl-talk@ucar.edu
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> or, via email, send a message with subject or body 'help' to
> ncl-talk-request@ucar.edu
>
> You can reach the person managing the list at
> ncl-talk-owner@ucar.edu
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of ncl-talk digest..."
>
>
> Today's Topics:
>
> 1. how to know the (i,j)or (lat,lon) of the max ( grace )
> 2. Crop a plot within NCL (Tabish Ansari)
> 3. Re: how to know the (i,j)or (lat,lon) of the max (Mary Haley)
> 4. County average using shape files (Cary Lynch)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 1 Jul 2014 16:25:35 +0800
> From: " grace " <313695096@qq.com>
> Subject: how to know the (i,j)or (lat,lon) of the max
> To: " ncl-talk " <ncl-talk@ucar.edu>
> Message-ID: <tencent_5D66381D55A0F3DA4B477623@qq.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi,all I have calculated the max Qgraup of each time from the wrfout data
> with the following program,
> but how can I know the (i,j)or (lat,lon) of the max ?Qgraup of each time??
> any information will be appreciated!
>
>
> ascii_file = "shishidataGRAUP1B333.txt"
> str = new(ntimes, "string")
> ? do it =0, ntimes-1,1 ; TIME LOOP
>
>
> print("Working on time: " + times(it) )
> res@TimeLabel = times(it) ; Set Valid time to use on plots
>
>
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ; First get the variables we will need
> if(isfilevar(a,"QGRAUP"))
> qi = wrf_user_getvar(a,"QGRAUP",it)
> qi = qi*1000.
> qi@units = "g/kg"
> qis=dim_max_n_Wrap(qi(13:15,:,:),0)
> end if
> ;print(qis)
> printVarSummary(qis)
> wmax1 = dim_max_n_Wrap(qis(:,:),0)
> ;print(wmax1)
> printVarSummary(wmax1)
> wmax2 = dim_max_n_Wrap(qis,0)
> ;print(wmax2)
> printVarSummary(wmax2)
> wmax=max(wmax2)?
> str(it) = sprintf("%12.8f", wmax)?
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140701/fd6f0f80/attachment.html
>
> ------------------------------
>
> Message: 2
> Date: Tue, 1 Jul 2014 17:31:15 +0530
> From: Tabish Ansari <tabishumaransari@gmail.com>
> Subject: Crop a plot within NCL
> To: "ncl-talk@ucar.edu USERS" <ncl-talk@ucar.edu>
> Message-ID:
> <CALLVTyuTZLYkfnhffM3BBEJoko8bVSdV+x7A9HjLYJZZq2=0=
> A@mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi
>
> I am trying to crop a plot of say, terrain in NCL. Lets say initially I
> have a plot that represents entire Asia and then I want to crop out only
> India out of it.
>
> I tried the mp resource mpMaxLatF mpMinLatF etc. but that resulted into
> only an Indian map being superposed over the same Asian terrain.
>
> Please help me resolve this issue.
>
> --
> Thanks & Regards
> Tabish Umar Ansari
> MS Research Scholar
> Environmental & Water Resources Engineering Division
> Department of Civil Engineering
> IIT Madras
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140701/7f7add50/attachment.html
>
> ------------------------------
>
> Message: 3
> Date: Tue, 1 Jul 2014 09:18:17 -0600
> From: Mary Haley <haley@ucar.edu>
> Subject: Re: how to know the (i,j)or (lat,lon) of the max
> To: grace <313695096@qq.com>
> Cc: ncl-talk <ncl-talk@ucar.edu>
> Message-ID:
> <CACNN_C+ccTfxjX4Krzu4dCaUCVg_3K5WkX6ED6cx99rF-qye=
> A@mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> To get the max index out of a 2D array, you need to use a combination of
> ndtooned, maxind, and ind_resolve.
>
> If "qi" is the variable you want the maximum from, then here's a three-step
> process.
>
> dims = dimsizes(qi) ; 1D array containing the three dimension sizes
>
> qi1d = ndtooned(qi(it,:,:)) ; convert to one-dimensional array
> ii = maxind(qi1d) ; get index where first maximum value
> occurs
> ij= ind_resolve(ii,dims) ; resolve back to original 2D array index
> locations
>
> The "ij" should be a 1 x 2 array, where ij(0,0) is the index of the middle
> dimension, and ij(0,1) is the index of the rightmost dimension of "qi"
>
> Here's one-step process you can use:
>
> ij= ind_resolve(maxind(ndtooned(qi(it,:,:))),dims(1:2))
>
> You can print the results with:
>
> print("max qi = " + qi(it,ij(0,0),ij(0,1)) + " at indexes " + ij(0,0) +
> "," + ij(0,1))
>
> To then get the lat,lon location of this ij location, use wrf_user_ij_to_ll
>
> latlon = wrf_user_ij_to_ll(a, ij(0,0), ij(0,1), True)
>
> print("lon location is: " + latlon(0))
>
> print("lat location is: " + latlon(1))
>
> --Mary
>
>
> On Tue, Jul 1, 2014 at 2:25 AM, grace <313695096@qq.com> wrote:
>
> > Hi,all
> > I have calculated the max Qgraup of each time from the wrfout data with
> > the following program,
> > but how can I know the (i,j)or (lat,lon) of the max ?Qgraup of each
> time?
> > ?
> > any information will be appreciated!
> >
> > ascii_file = "shishidataGRAUP1B333.txt"
> > str = new(ntimes, "string")
> > ? do it =0, ntimes-1,1 ; TIME LOOP
> >
> > print("Working on time: " + times(it) )
> > res@TimeLabel = times(it) ; Set Valid time to use on plots
> >
> > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> > ; First get the variables we will need
> > if(isfilevar(a,"QGRAUP"))
> > qi = wrf_user_getvar(a,"QGRAUP",it)
> > qi = qi*1000.
> > qi@units = "g/kg"
> > qis=dim_max_n_Wrap(qi(13:15,:,:),0)
> > end if
> > ;print(qis)
> > printVarSummary(qis)
> > wmax1 = dim_max_n_Wrap(qis(:,:),0)
> > ;print(wmax1)
> > printVarSummary(wmax1)
> > wmax2 = dim_max_n_Wrap(qis,0)
> > ;print(wmax2)
> > printVarSummary(wmax2)
> > wmax=max(wmax2)?
> > str(it) = sprintf("%12.8f", wmax)?
> >
> > _______________________________________________
> > ncl-talk mailing list
> > List instructions, subscriber options, unsubscribe:
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> >
> >
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140701/32946ecd/attachment.html
>
> ------------------------------
>
> Message: 4
> Date: Tue, 1 Jul 2014 10:21:15 -0700
> From: Cary Lynch <lynchc6@uw.edu>
> Subject: County average using shape files
> To: ncl-talk@ucar.edu
> Message-ID:
> <CAFxqo9JeUD9aNJ6u6rV=
> xkDJiu1RAygaFyQWatbysfdY-fCi0g@mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hello,
> I am having trouble calculating the US county area averages using gridded
> CONUS data and US county shape file data. The county polyline overlay
> works, but I cannot get the county area average function to work with my
> data.
> Following the example script
> www.ncl.ucar.edu/Applications/Scripts/shapefiles_13.ncl
> I am getting the following error:
>
> fatal: Subscript out of range, error in subscript #0
> fatal: An error occurred reading skip_check
>
> ;The CONUS data is land only for the coterminous US:
>
> hf1 = addfile("conus.nc","r")
> data = hf1->tmaxhist(:,:) ; ((/nlat,nlon/),float)
> lat = hf1->lat
> lon = hf1->lon
>
> ; The attributes of data and lat/lon are as follows:
> ; nlat = 222
> ; nlon = 462
> ; minlat/maxlat = 25.1875/52.8125
> ; minlon/maxlon = 235.312/292.938
> ; lat@units = "degrees_north"
> ; lon@units = "degrees_east"
>
>
> Any help would be much appreciated. Thank you.
> --
> Cary Lynch
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL:
> http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140701/0c23e11e/attachment.html
>
> ------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk@ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
> End of ncl-talk Digest, Vol 128, Issue 1
> ****************************************
>



--
With regards
Saurabh Kumar singh

 *P** : * *Please consider the environment before printing this e-mail*

Received on Tue Jul 01 06:45:24 2014

This archive was generated by hypermail 2.1.8 : Wed Jul 23 2014 - 15:33:46 MDT