[ncl-talk] Extracting all values of rh2 from WRF file and writing it to csv file
Rick Brownrigg
brownrig at ucar.edu
Wed Jan 2 19:59:30 MST 2019
HI,
That error message makes sense, since in a WRF file, the variables XLAT and
XLONG are 2D (curvilinear).
I guess I'm confused as to what you are trying to do. If you just simply
want the variable "rh2" written to an ascii file, instead of this:
allRH = rh2(:, lon, lat)
asciiwrite("rh2.csv",allRH)
what about just:
asciiwrite("rh2.csv",rh2)
A simple experiment revealed that this will write the 3D array, 1 value per
line, in "row major" format. This means to read such a file later, you must
have some way of knowing the shape and dimensionality.
Hope that helps....
Rick
On Wed, Jan 2, 2019 at 7:42 PM Muhammad Omer Mughal <
m.mughal1 at graduate.curtin.edu.au> wrote:
> Dear Rick
>
> Thanks for the reply. I changed the script to remove the SEGV error but
> now I am getting the following error messages
>
>
>
> Please see the script below
>
>
> a=addfile("wrfout_d03_2017-02-01_00:00:00.nc","r")
>
> rh2 = wrf_user_getvar(a,"rh2",-1)
>
> lat=wrf_user_getvar(a,"XLAT",-1)
> lon=wrf_user_getvar(a,"XLONG",-1)
>
>
> allRH = rh2(:, lon, lat)
>
> asciiwrite("rh2.csv",allRH)
>
> fatal:Illegal subscript. Subscripts must be scalar or one dimensional
> vectors
>
>
>
>
>
> Muhammad Omer Mughal
> MSc BSc Mechanical Engineering
> PhD Research Scholar
> Remote Sensing and Satellite Research Group
> Department of Imaging and Applied Physics
> Curtin University
>
> Curtin University
> Tel | +61 8 9266 7962
> Fax | +61 8 9266 2377
> Mobile | 0470 237 525
>
> Email | m.mughal1 at postgrad.curtin.edu.au <m.lynch at curtin.edu.au>
> Web | http://curtin.edu.au
>
> Curtin University is a trademark of Curtin University of Technology.
> CRICOS Provider Code 00301J (WA), 02637B (NSW)
>
>
> ------------------------------
> *From:* Rick Brownrigg <brownrig at ucar.edu>
> *Sent:* Wednesday, 2 January 2019 10:18:33 PM
> *To:* Muhammad Omer Mughal
> *Cc:* ncl-talk at ucar.edu
> *Subject:* Re: [ncl-talk] Extracting all values of rh2 from WRF file and
> writing it to csv file
>
> Hi,
>
> Can you share your script and dataset with me? I would like to
> investigate why there's a SEGV.
>
> Rick
>
>
> On Wed, Jan 2, 2019 at 4:49 AM Muhammad Omer Mughal <
> m.mughal1 at graduate.curtin.edu.au> wrote:
>
> Dear NCL team
>
> Is there a way to extract all values from WRF output files from all grind
> points and write to an ascii file.
> In my case grid size is 71x82 and the number of times is 673. I tried to
> write using a table format but I am getting a segmentation fault.
>
> I will appreciate help. Kindly note that I have used Lambert conformal
> projection method.
>
> Regards
>
>
>
> Muhammad Omer Mughal
> MSc BSc Mechanical Engineering
> PhD Research Scholar
> Remote Sensing and Satellite Research Group
> Department of Imaging and Applied Physics
> Curtin University
>
> Curtin University
> Tel | +61 8 9266 7962
> Fax | +61 8 9266 2377
> Mobile | 0470 237 525
>
> Email | m.mughal1 at postgrad.curtin.edu.au
> Web | http://curtin.edu.au
>
> Curtin University is a trademark of Curtin University of Technology.
> CRICOS Provider Code 00301J (WA), 02637B (NSW)
>
>
> _______________________________________________
> 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/20190102/468a7cbc/attachment.html>
More information about the ncl-talk
mailing list