Re: average modis files

From: Luo, Chao <chao.luo_at_nyahnyahspammersnyahnyah>
Date: Fri Sep 27 2013 - 10:22:21 MDT

Thanks, this works correct!

cl

----- Original Message -----
From: "Wei Huang" <huangwei@ucar.edu>
To: "Chao Luo" <chao.luo@eas.gatech.edu>
Cc: "Dennis Shea" <shea@ucar.edu>, "ncl-talk Talk" <ncl-talk@ucar.edu>
Sent: Friday, September 27, 2013 8:44:50 AM
Subject: Re: average modis files

Chao,

You need to convert characters to string first, and then convert string to integer.

Wei

huangwei@ucar.edu
VETS/CISL
National Center for Atmospheric Research
P.O. Box 3000 (1850 Table Mesa Dr.)
Boulder, CO 80307-3000 USA
(303) 497-8924

On Sep 27, 2013, at 9:14 AM, "Luo, Chao" <chao.luo@eas.gatech.edu> wrote:

> Thanks, this works! One more question is that I use str function to deal with MODIS file names, want to convert character "1030" to number "1030", I used charactertointeger, but it doesn't give correct number. Is there any function to do this?
>
> Thanks,
>
> cl
>
> ----- Original Message -----
> From: "Dennis Shea" <shea@ucar.edu>
> To: "Chao Luo" <chao.luo@eas.gatech.edu>
> Cc: "ncl-talk Talk" <ncl-talk@ucar.edu>
> Sent: Thursday, September 26, 2013 1:15:17 PM
> Subject: Re: average modis files
>
> Please read:
> http://www.ncl.ucar.edu/Document/Functions/Built-in/systemfunc.shtml
>
> fils = systemfunc("ls MYD06_L2.A2012061*hdf")
> nfils = dimsizes(fils)
> print("nfils="+nfils)
> print("============")
> print(fils)
>
> ====
> Further, read
> http://www.ncl.ucar.edu/Document/Functions/Built-in/ind.shtml
>
> ===
> Use the appropriate str_ function to get the desired files
>
> ii = ind(....)
>
> Read:
> http://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml
>
> f = addfiles(fils(ii), "r")
> printVarSummary(f[0]) ; look at 1st file
>
> ;ListSetType (f, "cat")
> ListSetType (f, "join") ; ???
> x = f[:]->VARIABLE
>
> Do appropriate averaging
>
>
>
>
>
> On 9/26/13 2:03 PM, Luo, Chao wrote:
>> Thanks Wei for your quick response! Yes, I can use string split function. But the thing is that I need to deal 560 files, that mean I need to hand input 560 alpha_string and digit_string. Is my understanding correct?
>>
>>
>> Thanks,
>>
>>
>> cl
>>
>> ----- Original Message -----
>>
>> From: "Wei Huang" <huangwei@ucar.edu>
>> To: "Chao Luo" <chao.luo@eas.gatech.edu>
>> Cc: "ncl-talk Talk" <ncl-talk@ucar.edu>
>> Sent: Thursday, September 26, 2013 12:52:41 PM
>> Subject: Re: average modis files
>>
>> Chao,
>>
>>
>> You may read:
>> http://www.ncl.ucar.edu/Document/Functions/Built-in/str_split_by_length.shtml
>>
>>
>> and use that function to process these file names.
>>
>>
>> Wei
>>
>>
>>
>>
>>
>>
>>
>> huangwei@ucar.edu
>> VETS/CISL
>> National Center for Atmospheric Research
>> P.O. Box 3000 (1850 Table Mesa Dr.)
>> Boulder, CO 80307-3000 USA
>> (303) 497-8924
>>
>>
>>
>>
>>
>>
>>
>>
>> On Sep 26, 2013, at 1:42 PM, "Luo, Chao" < chao.luo@eas.gatech.edu > wrote:
>>
>>
>>
>>
>> Hi,
>>
>>
>> I am working on modis files averaging from 5 minutes to daily files. There are 560 files in one month, the part2 and part3 in file name are hard to treat (part2 is time). And I want to average time from 11:00 to 22:00. Is there any easy way to do it instead of to hand input data file names? Following is file name sample. Any suggestions and help are very appreciated!
>>
>>
>> cl
>>
>>
>>
>>
>>
>>
>>
>>
>> part1 part2 part3
>> MYD06_L2.A2012061.0725.051.2012061201159.hdf
>> MYD06_L2.A2012061.0730.051.2012061201222.hdf
>> MYD06_L2.A2012061.0900.051.2012061201129.hdf
>> MYD06_L2.A2012061.0905.051.2012061201216.hdf
>> MYD06_L2.A2012061.0910.051.2012061201107.hdf
>> MYD06_L2.A2012061.1040.051.2012062180817.hdf
>> MYD06_L2.A2012061.1045.051.2012062180807.hdf
>> MYD06_L2.A2012061.1050.051.2012062175617.hdf
>> MYD06_L2.A2012061.1655.051.2012062180644.hdf
>> MYD06_L2.A2012061.1825.051.2012062182142.hdf
>> MYD06_L2.A2012061.1830.051.2012062182358.hdf
>> MYD06_L2.A2012061.1835.051.2012062180719.hdf
>> MYD06_L2.A2012061.2005.051.2012062180628.hdf
>> MYD06_L2.A2012061.2010.051.2012062180924.hdf
>> MYD06_L2.A2012061.2140.051.2012062181406.hdf
>> MYD06_L2.A2012061.2145.051.2012062181604.hdf
>> MYD06_L2.A2012061.2150.051.2012062181551.hdf
>> MYD06_L2.A2012062.0625.051.2012062223608.hdf
>> MYD06_L2.A2012062.0630.051.2012062223535.hdf
>> MYD06_L2.A2012062.0635.051.2012062223817.hdf
>> MYD06_L2.A2012062.0805.051.2012062223618.hdf
>> MYD06_L2.A2012062.0810.051.2012062223602.hdf _______________________________________________
>> 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

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Sep 27 10:22:40 2013

This archive was generated by hypermail 2.1.8 : Tue Oct 01 2013 - 14:41:43 MDT