[ncl-talk] Reading Multiple Files stored in Short Format

Bappaditya Nag bappaditya.nag82 at gmail.com
Sun Jul 29 23:40:07 MDT 2018


HI Toni,

Thank you for the response. That option clicked my mind, but I tried to
avoid it since, time dimension for different files are of different sizes
and the work might be a little tedious. But it is also true that if someone
has not come across this problem previously and with a concise solution, I
will have to eventually sort to such a method.

Regards,
Bappaditya Nag
Post-doctoral Research Scholar
Earth, Ocean and Atmospheric Science
Florida State University
Ph. No. : +91-8697458936

On Mon, Jul 30, 2018 at 10:48 AM, Toni Klemm <toni-klemm at tamu.edu> wrote:

> Hi Bappaditya,
>
> Have you tried creating a new, empty array of the same size of all the
> files you want to concatenate and then create a loop in which you read in a
> single file, convert it to from short to float and then “add” it to your
> array?
>
> I’m not familiar with your data, so my idea might not work for you. Good
> luck though!
>
> Greetings from Texas,
> Toni
>
>
> *Toni Klemm**, Ph.D.*
> Postdoctoral Research Associate
> Department of Ecosystem Science and Management
> Texas A&M University, College Station, TX
> Contributor at the Early Career Climate Forum <https://www.eccforum.org/>
> www.toni-klemm.de | @toniklemm <https://twitter.com/ToniKlemm>
>
>
> On Jul 30, 2018, at 12:00 AM, Bappaditya Nag <bappaditya.nag82 at gmail.com>
> wrote:
>
> Hi,
>
> I have 6 hrly ERA-Interim data stored in chunks of monthly files in short
> format (i.e., each file have their own scale and offset factor). When I
> read such multiple files in ncl (i.e., using v->f[:]) and convert to float
> (i.e., using short2flt), I do not get the correct result since the scale
> and offset of the first file is used for all the files.
>
> Solution : I can unpack and repack the files in a single file, but that is
> against the purpose of storing the data in optimal compact format. I am
> looking for a solution to read every file, convert to float and
> then concatenate the data. Can this be done? Or any other more
> effcient solution. Any help is appreciated.
>
> Present Code is as follows:
>
> files = systemfunc("ls " + dir + "ERA_Interim/ERA_Interim_v_"+year+"*.nc")
> fil = addfiles(files,"r")
> ListSetType (fil, "cat")
> v6hrly = short2flt(fil[:]->v(iStrt:iLast,{lev1:lev2},:,:))
>
> Also attached is a figure generated from the code.
>
> Warm Regards,
> Bappaditya Nag
> Post-doctoral Scholar
> Florida State University
>
> <xt_Meridional Wind.png>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> 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/20180730/f28d3712/attachment.html>


More information about the ncl-talk mailing list