# Re: checking index locations in a long number

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Dec 28 2010 - 08:01:46 MST

Hi Jeff,

If this variable is a long (it might be too big to be an integer), you can convert to a string and then use str_get_cols to extract the pieces you need.

For example:

vars = (/2001111988555l,2001121988555l,2001131988555l/)
print(vars)
svars = "" + vars
print(svars)
jjj = toint(str_get_cols(svars,4,6)) ; index count starts at 0
print(jjj)

--Mary

On Dec 27, 2010, at 10:23 AM, Dennis Shea wrote:

> It is not clear if YYYYJJJHTTNNN is a string or an integer?
>
> You can extract (say) JJJ to a 1d array
>
> idx = ind(JJJ.ge.??? .and. JJJ.le.???)
>
> Then use the index values to access the data.
>
> http://www.ncl.ucar.edu/Document/Functions/Built-in/ind.shtml
>
> On 12/27/10 10:15 AM, JEFFREY JOSEPH WATERS wrote:
>> NCL,
>> I am currently reading in serial numbers that correspond to TC events
>> and locations over the last 20 years.
>>
>> YYYYJJJHTTNNN
>>
>> * YYYY is the corresponding year of the first recorded observation
>> of the storm
>> * JJJ is the day of year of the first recorded observation of the storm
>> * H is the hemisphere of the storm: N=Northern, S=Southern
>> * TT is the absolute value of the rounded latitude of the first
>> recorded observation of the storm (range 0-90, if basin=SA or SH,
>> then TT in reality is negative)
>> * NNN is the rounded longitude of the first recorded observation of
>> the storm (range 0-359)
>>
>> I was wondering if NCL has a way to analyze only certain locations (i.e.
>> index locations 5-7, or the JJJ values) within this serial number.
>> Perhaps an if-else check of some sort? I was having trouble finding any
>> useful method or function on the NCL site. Any help would be much
>> appreciated. Thank you.
>>
>> Jeff Waters
>> Department of Meteorology
>> Penn State University '11
>>
>>
>>
>>
>> _______________________________________________
>> 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 Tue Dec 28 08:01:54 2010

This archive was generated by hypermail 2.1.8 : Tue Jan 04 2011 - 09:16:52 MST