Re: read multiple WRF files

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Feb 25 2014 - 22:07:44 MST

Hi,

Renaming the files is certainly one way to do it. Or, you can do it programmatically by adding the “.nc” to the list of files:

fils = systemfunc(“ls /net/17/zb/wrfout2/haze_2013/ctrl/07/*”) + “.nc”

Note: “addfiles_GetVar” has been deprecated for awhile, and I don’t think it is being called correctly anyway.

I believe what you want is:

  fils = systemfunc ("ls /net/17/zb/wrfout2/haze_2013/ctrl/07/*")
  f = addfiles (all_files, "r")
  T = f[:]->T2

By default, these calls will cause the leftmost dimensions to be concatenated (“cat”mode).

If you want the a new dimension created rather than the concatenation (“join” mode), then do this:

  fils = systemfunc ("ls /net/17/zb/wrfout2/haze_2013/ctrl/07/*")
  f = addfiles (all_files, "r”)
  ListSetType(f,”join”
  T = f[:]->T2

Please see the “addfiles” documentation for more information:

http://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml

—Mary

On Feb 25, 2014, at 2:09 AM, Marston Johnston <shejo284@gmail.com> wrote:

> Hi,
>
> Wouldn't the easiest thing be renaming your files and add the ".nc" suffix? This is easily done in bash:
>
> for i in *.*; do mv $i $i.nc; done
>
> Hope this helps,
> /M
>
>
> On Tue, Feb 25, 2014 at 9:27 AM, zhangbinrc <zhangbinrc@163.com> wrote:
> Hi,
>
> I’m reading multiple WRF files, for example wrfout_d01_2013-04-01_00:00:00 and wrfout_d01_2013-04-02_00:00:00 using the following codes:
>
> fils = systemfunc ("ls /net/17/zb/wrfout2/haze_2013/ctrl/07/*")
> f = addfiles (all_files, "r")
> T = addfiles_GetVar (f, fils, "T2")
>
> The problem is that the WRF files are in netcdf format, however they do not have a suffix of “.nc”. So that the script could not read in the files. Is there any way I can fix this?
>
> Thanks!
>
> 张斌 博士生/Bin Zhang Ph.D. Candidate
> 清华大学地球系统科学研究中心/ Center for Earth System Science, Tsinghua
> Email:zhangbin06@mails.tsinghua.edu.cn
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
>
> --
> Only the fruitful thing is true!
> _______________________________________________
> 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 Feb 25 22:07:55 2014

This archive was generated by hypermail 2.1.8 : Mon Mar 03 2014 - 14:26:18 MST