[ncl-talk] [NCL Digest] python transition (ali mughal)

Marco Miani m.miani at cyi.ac.cy
Sat Dec 5 06:52:12 MST 2020


Hi Ali,

Python has something called PyNGL which, as the name suggests, is a python based NCL platform.
The structure is very similar to pure NCL, and so is the slicing of data:

At the bottom of this message, I enclose a little snippet.
More infos can be found here, on the official webpage:
https://www.pyngl.ucar.edu/

Did this help?
Bye

Marco




#

#  File:

#    newcolor1.py

#

#  Synopsis:

#    Illustrates new color capabilities in PyNGL 1.5.0.

#

#  Categories:

#    Contouring

#

#  Author:

#    Mary Haley

#

#  Date of initial publication:

#    November 2012

#

#  Description:

#    This example shows how to use the new cnFillPalette resource.

#

#  Effects illustrated:

#    o  Using the new "cnFillPalette" resource.

#    o  Using a named color without having to add it to color map

#

#  Output:

#    This example produces one visualization

#

#  Notes:

#

from __future__ import print_function

import os, numpy

import Ngl, Nio



#

# Create some dummy data for the contour plot.

#

dirc = Ngl.pynglpath("data")

f    = Nio.open_file(os.path.join(dirc,"cdf","uv300.nc"))

u    = f.variables["U"][1,:,:] # <-----Ali, this is what you are looking for!

lat  = f.variables["lat"][:]

lon  = f.variables["lon"][:]



wks_type = "png"

wks = Ngl.open_wks(wks_type,"newcolor1")



cnres                 = Ngl.Resources()



# Contour resources

cnres.cnFillOn        = True

cnres.cnFillPalette   = "BlueYellowRed"      # New in PyNGL 1.5.0

cnres.cnLinesOn       = False

cnres.cnLineLabelsOn  = False



# Labelbar resource

cnres.lbOrientation   = "horizontal"



# Scalar field resources

cnres.sfXArray        = lon

cnres.sfYArray        = lat



# Map resources

cnres.mpFillOn               = True

cnres.mpFillDrawOrder        = "PostDraw"

cnres.mpLandFillColor        = "Gray"

cnres.mpOceanFillColor       = "Transparent"

cnres.mpInlandWaterFillColor = "Transparent"



contour = Ngl.contour_map(wks,u,cnres)



Ngl.end()


Marco Miani
Computational Support Specialist
Climate and Atmosphere Research Center (CARE-C)
The Cyprus Institute
20 Konstantinou Kavafi Street, 2121, Nicosia, Cyprus
Tel: +357 22 397 561<tel:+357%2022%20397%20561> | Email: m.miani at cyi.ac.cy<mailto:m.miani at cyi.ac.cy>
Web: cyi.ac.cy<https://cyi.ac.cy/> | emme-care.cyi.ac.cy<https://emme-care.cyi.ac.cy/>
Follow us on [cid:image004.png at 01D6CB1E.950330C0] <https://www.facebook.com/CyprusInstitute/> [cid:image005.png at 01D6CB1E.950330C0] <https://twitter.com/CyprusInstitute> [cid:image006.png at 01D6CB1E.950330C0] <https://www.linkedin.com/company/the-cyprus-institute>
P Please consider the environment before printing this email


From: ncl-talk-request at mailman.ucar.edu<mailto:ncl-talk-request at mailman.ucar.edu>
Sent: 04 December 2020 21:00
To: ncl-talk at mailman.ucar.edu<mailto:ncl-talk at mailman.ucar.edu>
Subject: ncl-talk Digest, Vol 205, Issue 5

Send ncl-talk mailing list submissions to
        ncl-talk at mailman.ucar.edu

To subscribe or unsubscribe via the World Wide Web, visit
        https://mailman.ucar.edu/mailman/listinfo/ncl-talk
or, via email, send a message with subject or body 'help' to
        ncl-talk-request at mailman.ucar.edu

You can reach the person managing the list at
        ncl-talk-owner at mailman.ucar.edu

When replying, please edit your Subject line so it is more specific
than "Re: Contents of ncl-talk digest..."


Today's Topics:

   1. Re: Setting X-axis for proper data plotting (Adam Phillips)
   2. Effective Degree of Freedom (dickson mbigi)
   3. Re: Plot csv file (Anahita Amiri Farahani)
   4. python transition (ali mughal)
   5. wrfout file reading (Anil Kumar - NOAA Affiliate)
   6. Re: wrfout file reading (Ehsan Taghizadeh)
   7. Re: wrfout file reading (Anil Kumar - NOAA Affiliate)
   8. Re: wrfout file reading (Anil Kumar - NOAA Affiliate)


----------------------------------------------------------------------

Message: 1
Date: Thu, 3 Dec 2020 18:12:48 -0700
From: Adam Phillips <asphilli at ucar.edu>
To: "Herb, Jason" <jherb at albany.edu>
Cc: "ncl-talk at ucar.edu" <ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] Setting X-axis for proper data plotting
Message-ID:
        <CACvWuqB=NnFQjPePoRUrrB+Okd74DLs+Bj3-ttjcdTzjv_ONcg at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi Jason,
Thank you for sending an easy-to-run script. I have attached a modified
script along with the resulting graphic.
Two things to note:
1 - I altered your asciiread statement to read in the data as a double,
that way you can see the correct time. I then manually created my own
yyyymmddhh array from the original time. Note that I assumed that the data
is regular and that there are not any missing timesteps from
20061221-20191231.95833. Once I passed the yyyymmddhh array into
yyyymmddhh_to_yyyyfrac I now have a regular time coordinate to pass into
gsn_csm_xy. This alleviates the jumping you were getting in your plot.
Please look at the print statement output and coding and make sure the
assumptions I made are correct.

2 - To get better control of the tick mark labels, I recommend setting
tmXBMode = "Explicit", and setting tmXBValues/tmXBLabels. See the
tickmarks application
page <http://www.ncl.ucar.edu/Applications/tickmarks.shtml> for other
examples of using these resources.

Hope that helps!
Adam

On Wed, Dec 2, 2020 at 2:39 PM Herb, Jason via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Hello All,
>
> I have been working with a continuous data set from late 2006 to end of
> 2019. I have been able to force the X-axis labeling as close as I can to
> get year to whole numbers, but I keep getting ".0" at the end of the year.
> Also, I have a plotting error in the actual data with the space containing
> "flat lines" between the end or one year to the start of the next. I
> attempted to setup another array for the year but get the following error
> message :
>
> fatal:Illegal subscript. Subscripts must be integer when not using
> coordinate indexing
> fatal:["Execute.c":8640]:Execute: Error occurred at or near line 36 in
> file Basiclineplot.ncl
>
> I have attached the plot, script and input file.
> Does anyone have any suggestions to assist with this plotting issue?
>
> Thanks,
> Jason
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk



--
Adam Phillips
Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
www.cgd.ucar.edu/staff/asphilli/<http://www.cgd.ucar.edu/staff/asphilli/>   303-497-1726

<http://www.cgd.ucar.edu/staff/asphilli>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201203/6db121df/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.png
Type: image/png
Size: 75791 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201203/6db121df/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Basiclineplot.ncl
Type: application/octet-stream
Size: 1663 bytes
Desc: not available
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201203/6db121df/attachment-0001.obj>

------------------------------

Message: 2
Date: Fri, 4 Dec 2020 11:23:49 +0800
From: dickson mbigi <dickson.mbigi at gmail.com>
To: ncl-talk at mailman.ucar.edu
Subject: [ncl-talk] Effective Degree of Freedom
Message-ID:
        <CALUZNzMQqxTPetw2OtW_nNt9px6Jh0DHeNPdDupykrvqSPxSDA at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Okay got it.
Thanks

On Fri, Dec 4, 2020 at 2:21 AM <ncl-talk-request at mailman.ucar.edu> wrote:

> Send ncl-talk mailing list submissions to
>         ncl-talk at mailman.ucar.edu
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://mailman.ucar.edu/mailman/listinfo/ncl-talk
> or, via email, send a message with subject or body 'help' to
>         ncl-talk-request at mailman.ucar.edu
>
> You can reach the person managing the list at
>         ncl-talk-owner at mailman.ucar.edu
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of ncl-talk digest..."
>
>
> Today's Topics:
>
>    1. Effective Degree of Freedom (dickson mbigi)
>    2. Re: NCARG_COLORMAPS in conda (Jian Zheng)
>    3. Re: Effective Degree of Freedom (Dennis Shea)
>    4. Plot csv file (Anahita Amiri Farahani)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 3 Dec 2020 08:25:59 +0800
> From: dickson mbigi <dickson.mbigi at gmail.com>
> To: NCL-talk <ncl-talk at ucar.edu>
> Subject: [ncl-talk] Effective Degree of Freedom
> Message-ID:
>         <CALUZNzOzszoPZz5xRtZeLVbZYaNkXpVy=
> q+RRBY5sVm4uxUiqw at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi everyone,
> I have sst(time) and pre(lon,lat,time) low pass filtered data sets. I can
> calculate spatial correlation, but for the significance test   using
> Student's t- test I need to use effective degrees of freedom because  my
> data have been filtered. I went through NCL website and found ''equivalent
> sample size'' function which I think is quite different from the effective
> degrees of freedom. Is there a function or a way to use Effective Degree of
> freedom to perform significance tests in spatial correlation analysis?
>
> Ndof =N(1-r1r2)/(1+r1r2), where N is sample size, r1&r2 are the lag-1
> autocorrelations of the two time series.
>
> Thanks in advance.
> Dickson.
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201203/cfbd359e/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 2
> Date: Thu, 3 Dec 2020 11:13:39 +0800
> From: Jian Zheng <jzheng8606 at gmail.com>
> To: Rick Brownrigg <brownrig at ucar.edu>
> Cc: Ncl-talk <ncl-talk at ucar.edu>
> Subject: Re: [ncl-talk] NCARG_COLORMAPS in conda
> Message-ID:
>         <
> CAFMEVXN2tHnLXEYVyhdMb4iR3OL0Swd+3FEZNp8PETiNL09SxA at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi Rick,
>
> I find that defining NCARG_COLORMAPS after the conda-initializing part in
> the .bash_profile can solve the problem.
>
> Thanks a lot for all your help.
> Jian
>
> On Sat, Nov 21, 2020 at 12:22 AM Rick Brownrigg <brownrig at ucar.edu> wrote:
>
> > Hi Jian,
> >
> > When you say it is not working, are you getting messages such as this
> when
> > you try to reference your custom colormap:
> >
> > fatal:CvtStringToCmap:Unable to convert string "foo" to ColorMap
> > warning:Error retrieving resource wkColorMap from args - Ignoring Arg
> >
> > I don't know where the OLD_NCARG_COLORMAPS setting would be coming from
> in
> > your environment. I would note that the second path in it --
> > /lib/ncarg/colormaps -- would be incorrect. I don't know that it would
> > break things if the first path is correct however.
> >
> > I have a stock ncl installation from conda. I copied an arbitrary
> colormap
> > from $NCARG_ROOT/lib/colormaps into /tmp, renamed it "foo.rgb", and set
> > NCARG_COLORMAPS=/tmp. Then when I run this little script, everything
> works:
> >
> > ncl 1>   wks = gsn_open_wks("x11","test")
> > ncl 2>   gsn_define_colormap(wks,"foo")
> > ncl 3> gsn_draw_colormap(wks)
> >
> > if I unset NCARG_COLORMAPS, and re-run, then I get the fatal/warning
> > errors mentioned above.
> >
> > So I would have to conclude something is not quite right in your
> > environment. Perhaps before trying to set envvars via .bash_profile,
> > perhaps try setting them on the command line. Are you certain your
> colormap
> > is in the directory you cite? Are you certain its format is valid for
> NCL?
> > Perhaps try what I did -- copying a known colormap into your custom
> > directory, rename it to something that does not collide with NCL's
> colormap
> > names, and see if you  can get the little scriptlet above to work.
> >
> > I hope that helps...
> > Rick
> >
> >
> > On Fri, Nov 20, 2020 at 8:54 AM Jian Zheng <jzheng8606 at gmail.com> wrote:
> >
> >> Hi Rick,
> >>
> >> When I ran "env | grep NCARG", I got
> >>
> >>
> >>
> OLD_NCARG_COLORMAPS=/Users/jzheng/Documents/nclcolormap:/lib/ncarg/colormaps
> >>
> >> NCARG_ROOT=/Users/jzheng/opt/miniconda3
> >>
> >>
> >> Does it show you more information?
> >>
> >>
> >> On Fri, Nov 20, 2020 at 12:49 PM Rick Brownrigg <brownrig at ucar.edu>
> >> wrote:
> >>
> >>> Hi Jian,
> >>>
> >>> Offhand that all looks reasonable. Only you can verify the custom path.
> >>> Did you "source" your .bash_profile after you modified it?  I'm not
> sure
> >>> what else to suggest.
> >>>
> >>> Rick
> >>>
> >>> On Thu, Nov 19, 2020 at 9:34 PM Jian Zheng <jzheng8606 at gmail.com>
> wrote:
> >>>
> >>>> Hi Rick,
> >>>>
> >>>> NCARG_COLORMAPS (export
> >>>>
> NCARG_COLORMAPS=/Users/jzheng/Documents/nclcolormap:$NCARG_ROOT/lib/ncarg/colormaps)
> >>>> contains the directory where I put my user-defined colormap files.
> When I
> >>>> run ncl, it doesn't see these colormaps.
> >>>>
> >>>> Thanks,
> >>>> Jian
> >>>>
> >>>> On Thu, Nov 19, 2020 at 9:33 PM Rick Brownrigg <brownrig at ucar.edu>
> >>>> wrote:
> >>>>
> >>>>> Hi,
> >>>>>
> >>>>> What do you mean "it does not work"?  What happens?  Normally one
> >>>>> should not need to set that environment variable unless there's
> something
> >>>>> unusual about the way the code is installed.  It is common however
> to set
> >>>>> NCARG_ROOT, and that should point to the directory containing the NCL
> >>>>> installation; i.e., the directory with the bin/ lib/ include/ and
> man/
> >>>>> directories belonging to NCL.  I don't recall offhand where a stock
> conda
> >>>>> install places those directories.
> >>>>>
> >>>>> Rick
> >>>>>
> >>>>>
> >>>>> On Thu, Nov 19, 2020 at 1:47 AM Jian Zheng via ncl-talk <
> >>>>> ncl-talk at mailman.ucar.edu> wrote:
> >>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> I installed ncl6.6.2 in conda root environment. When I set
> NCARG_COLORMAPS
> >>>>>> in my ~/.bash_profile file, it did not work. How should I set
> NCARG_COLORMAPS
> >>>>>> with conda correctly?
> >>>>>>
> >>>>>> Thanks,
> >>>>>> Jian
> >>>>>> _______________________________________________
> >>>>>> ncl-talk mailing list
> >>>>>> ncl-talk at mailman.ucar.edu
> >>>>>> List instructions, subscriber options, unsubscribe:
> >>>>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
> >>>>>
> >>>>>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201203/e73faef6/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 3
> Date: Thu, 3 Dec 2020 09:44:35 -0700
> From: Dennis Shea <shea at ucar.edu>
> To: dickson mbigi <dickson.mbigi at gmail.com>
> Cc: NCL-talk <ncl-talk at ucar.edu>
> Subject: Re: [ncl-talk] Effective Degree of Freedom
> Message-ID:
>         <CAOF1d_6CO1djz=
> ZCQgjRGhqtuw1yEoxe4n62APfcgJHaXJ7sgw at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> I believe you have asked this question before.
>
> ****ncl-talk is not a statistics forum. ****
> * ***Please talk to a statistician****
>
> ====
> (1) Possibly:
> You could use *esacr*
> <http://www.ncl.ucar.edu/Document/Functions/Built-in/esacr.shtml> or
> *esacr_n*
> <http://www.ncl.ucar.edu/Document/Functions/Built-in/esacr_n.shtml>
> (esacr_n is available in NCL 6.5.0 and later) on the filtered series to get
> the lag_1 autocorrelation coefficients.
>
> r_sst   = esacr(sst,1)
> r1_sst = r_sst(1)              ; scalar; r1_sst(1)
> r1_sst at long_name = "Lag-1 autocorrelation: sst
> print(r1_sst)
>                                         ; pre(lat,lon,time)  ... time is
> rightmost dimension
> r_pre  = esacr(pre,1)       ; r_pre(2,lat,lon,time)
> r1_pre = r_pre(1,:,:)        ; r1_pre(nlat,mlom)
> r1_pre at long_name = "Lag-1 autocorrelation: pre"
> printVarSummary(r1_pre)
> printMinMax(r1_pre)
>
>
> r1_sst *:=* conform(r1_pre, r1_sst, -1)   ; := overwrite
> printVarSummary(r1_sst)                 ; (nlat,mlon)
>
> r1_sst_pre = r1_sst*r1_pre              ; array (grid point-by-grid
> point) multiply
>
> Ndof = N*(1-r1_sst_pre)/(1+r1_sst_pre), where N is the original sample
> size of time series
>
> printVarSummary(Ndof)                   ; (nlat,mlon)
>
> printMinMax(Ndof,0)
>
>
> ====
> (2)
> Perhaps, a better approach:
>
> DOI: 10.1016/S0275-1062(04)90014-8
> (2004) Determination of the degree of freedom of digital filtered time
> series with an application to the correlation analysis between the length
> of day and the Southern oscillation index
> ====
>
> Again, it is best to talk with a statistician.
>
>
> On Wed, Dec 2, 2020 at 5:26 PM dickson mbigi via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
> > Hi everyone,
> > I have sst(time) and pre(lon,lat,time) low pass filtered data sets. I can
> > calculate spatial correlation, but for the significance test   using
> > Student's t- test I need to use effective degrees of freedom because  my
> > data have been filtered. I went through NCL website and found
> ''equivalent
> > sample size'' function which I think is quite different from the
> effective
> > degrees of freedom. Is there a function or a way to use Effective Degree
> of
> > freedom to perform significance tests in spatial correlation analysis?
> >
> > Ndof =N(1-r1r2)/(1+r1r2), where N is sample size, r1&r2 are the lag-1
> > autocorrelations of the two time series.
> >
> > Thanks in advance.
> > Dickson.
> > _______________________________________________
> > ncl-talk mailing list
> > ncl-talk at mailman.ucar.edu
> > List instructions, subscriber options, unsubscribe:
> > https://mailman.ucar.edu/mailman/listinfo/ncl-talk
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201203/7b26972c/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 4
> Date: Thu, 3 Dec 2020 13:21:04 -0500
> From: Anahita Amiri Farahani <aamir003 at ucr.edu>
> To: "ncl-talk [ncl-talk]" <ncl-talk at ucar.edu>
> Subject: [ncl-talk] Plot csv file
> Message-ID:
>         <
> CAABdVry-zwn-y4omPNi2VNYVJPQOUP_W5ZqEUb7ZhsBTphScvA at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hello all,
>
> I tried to read and plot the csv data, but I faced some errors. I've
> attached both data and the code.
>
> Thank you,
> ana
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201203/a266e1eb/attachment.html
> >
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: Book4.csv
> Type: text/csv
> Size: 1320725 bytes
> Desc: not available
> URL: <
> https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201203/a266e1eb/attachment.csv
> >
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: test.ncl
> Type: application/octet-stream
> Size: 2564 bytes
> Desc: not available
> URL: <
> https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201203/a266e1eb/attachment.obj
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> ------------------------------
>
> End of ncl-talk Digest, Vol 205, Issue 3
> ****************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201204/539c7862/attachment-0001.html>

------------------------------

Message: 3
Date: Fri, 4 Dec 2020 00:05:25 -0500
From: Anahita Amiri Farahani <aamir003 at ucr.edu>
To: Dennis Shea <shea at ucar.edu>
Cc: "ncl-talk \[ncl-talk\]" <ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] Plot csv file
Message-ID:
        <CAABdVrzKKXHmB--=s0q0XHdzDDLG7YJyBQkKZq4THzA=574VLg at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Thank you so much!

On Thu, Dec 3, 2020 at 7:12 PM Dennis Shea <shea at ucar.edu> wrote:

> There are several *wrong* assignments. For example, the following is not
> correct.
>
> total= new((/5,21488/),typeof(bc),bc at _FillValue)
> [SNIP]
> total!0       = "lat"
> total!1       = "lon"
> ======
> The following dimension names would be more appropriate for the 'total'
> variable. There are 5 (=ncol) variables.
>
> N = *dimsizes*(lat1)
> total= *new*((/ncol,N/),*typeof*(bc),bc at _FillValue)
> total!0       = "variable"     ; 0->longitude, 1->latitude,  2->NO,
> 3->NO2,  4->BC
> total!1       = "value"
> =======
> The attached is a modification of the following example.
>
> See:   *http://www.ncl.ucar.edu/Applications/station.shtml*
> <http://www.ncl.ucar.edu/Applications/station.shtml>
>           Example 1
>
>
>
>
> On Thu, Dec 3, 2020 at 11:22 AM Anahita Amiri Farahani via ncl-talk <
> ncl-talk at mailman.ucar.edu> wrote:
>
>> Hello all,
>>
>> I tried to read and plot the csv data, but I faced some errors. I've
>> attached both data and the code.
>>
>> Thank you,
>> ana
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at mailman.ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201204/4f22cf88/attachment-0001.html>

------------------------------

Message: 4
Date: Fri, 4 Dec 2020 16:31:01 +0800
From: ali mughal <mughalali655 at gmail.com>
To: Ncl-talk <ncl-talk at ucar.edu>
Subject: [ncl-talk] python transition
Message-ID:
        <CAB5RZE2H_p3m0YOUDi6sqtPKF+ZnQ-sPAx-jt6FxgbwXP+6LRw at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Dear NCL users

Could you tell me the equivalent of the following NCL command in python ?

TC2=TA_MEAN(:,0,:,:)

where TA_MEAN is a 4d variable with the following dimensions

 Dimensions and sizes: [Time | 745] x [bottom_top | 50] x [south_north |
129] x [west_east | 210])
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201204/87497f4a/attachment-0001.html>

------------------------------

Message: 5
Date: Fri, 4 Dec 2020 09:27:36 -0500
From: Anil Kumar - NOAA Affiliate <anil.kumar at noaa.gov>
To: ncl-talk at mailman.ucar.edu
Subject: [ncl-talk] wrfout file reading
Message-ID:
        <CA+8gui_--oMeV9bJXmhjJoG-cRCMsVpNwAcu+aE+n=cx18rRhw at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Hi,
I am trying to read multiple wrfout files. I am reading okay..no problem
with the code extracting variables.
Problem comes, when each file has multiple times in it and then I don't
know how to extract the time series of variables .
Below is the code, please let me know how to modify code to read many times
within each file.
************************
fs1 = systemfunc("ls ../WRFV3/run/wrfout_d01*")
 nfs1= dimsizes(fs1)
 f1 = addfiles(fs1+".nc","r")
  ntimes1 =  dimsizes(f1)         ; number of times in the file(s)

loc1 = wrf_user_ij_to_ll(f1, 593., 546., True)
 print("lon/lat locations are: " + loc)
uu1      = new((/ntimes1/),float)
vv1      = new((/ntimes1/),float)
psfc1      = new((/ntimes1/),float)
i1=0
do while (i1.le.ntimes1-1)
uu1(i1)    = f1[i1]->U(:,0,546,593)   ; (time, lat,lon)    ; (2,64,128)
vv1(i1)    = f1[i1]->V(:,0,546,593)        ; V10(:,29.301,-94.797)
psfc1(i1)  = f1[i1]->PSFC(:,546,593)
i1 = i1 + 1
end do
   model_wspd1 = sqrt(uu1^2+vv1^2) ;wind_speed(uu,vv)
   model_wdir1 = wind_direction(uu1,vv1,0)
   model_psfc1 = psfc1/100.
************************
--
Dr. Anil Kumar
Environmental Modeling Center/NCEP/NWS/NOAA
College Park, MD, USA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201204/3deb1c85/attachment-0001.html>

------------------------------

Message: 6
Date: Fri, 4 Dec 2020 17:42:27 +0000 (UTC)
From: Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com>
To: Anil Kumar - NOAA Affiliate <anil.kumar at noaa.gov>
Cc: Ncl-talk <ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] wrfout file reading
Message-ID: <2131133709.2884490.1607103747892 at mail.yahoo.com>
Content-Type: text/plain; charset="utf-8"

 Dear Dr. AnilAre your wrfout files hourly?However, why you don't use wrf_user_list_times to extract the list of available times?
fs1 = systemfunc("ls ../WRFV3/run/wrfout_d01*")
nfs1= dimsizes(fs1)do i = 0, nfs1-1
 ?f1 = addfile(fs1(i)+".nc","r") times = wrf_user_list_times(f1) ; get times in the file  ntimes = dimsizes(times)         ; number of times in the file(s)
end doSincerely
Ehsan
    On Friday, December 4, 2020, 05:57:54 PM GMT+3:30, Anil Kumar - NOAA Affiliate via ncl-talk <ncl-talk at mailman.ucar.edu> wrote:

 Hi,I am trying to read multiple wrfout files. I am reading okay..no problem with the code extracting variables.?Problem comes, when each file has multiple times in it and then I don't know how to extract the time series of variables .?Below is the code, please let me know how to modify code to read many times within each file.************************fs1 = systemfunc("ls ../WRFV3/run/wrfout_d01*")
?nfs1= dimsizes(fs1)
?f1 = addfiles(fs1+".nc","r")
? ntimes1 =? dimsizes(f1) ? ? ? ? ; number of times in the file(s)

loc1 = wrf_user_ij_to_ll(f1, 593., 546., True)
?print("lon/lat locations are: " + loc)
uu1 ? ? ?= new((/ntimes1/),float)
vv1 ? ? ?= new((/ntimes1/),float)
psfc1 ? ? ?= new((/ntimes1/),float)
i1=0
do while (i1.le.ntimes1-1)
uu1(i1) ? ?= f1[i1]->U(:,0,546,593) ? ; (time, lat,lon) ? ?; (2,64,128)
vv1(i1) ? ?= f1[i1]->V(:,0,546,593) ? ? ? ?; V10(:,29.301,-94.797)
psfc1(i1) ?= f1[i1]->PSFC(:,546,593)
i1 = i1 + 1
end do
? ?model_wspd1 = sqrt(uu1^2+vv1^2) ;wind_speed(uu,vv)
? ?model_wdir1 = wind_direction(uu1,vv1,0)
? ?model_psfc1 = psfc1/100.
************************--
Dr. Anil KumarEnvironmental Modeling Center/NCEP/NWS/NOAA
College Park, MD, USA??

_______________________________________________
ncl-talk mailing list
ncl-talk at mailman.ucar.edu
List instructions, subscriber options, unsubscribe:
https://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201204/fc1b9e52/attachment-0001.html>

------------------------------

Message: 7
Date: Fri, 4 Dec 2020 13:01:45 -0500
From: Anil Kumar - NOAA Affiliate <anil.kumar at noaa.gov>
To: Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com>
Cc: Ncl-talk <ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] wrfout file reading
Message-ID:
        <CA+8gui_xL-OFWfeLrL8YsQ+x0=oZXYty6y=LHssjCvY21ijWhg at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Yes, wrf outputs are hourly files. Each hourly file has 10 multiple times
(6 mins interval).

Thanks,
Anil


On Fri, Dec 4, 2020 at 12:42 PM Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com>
wrote:

> Dear Dr. Anil
> Are your wrfout files hourly?
> However, why you don't use wrf_user_list_times to extract the list of
> available times?
>
> fs1 = systemfunc("ls ../WRFV3/run/wrfout_d01*")
> nfs1= dimsizes(fs1)
> do i = 0, nfs1-1
>     f1 = addfile(fs1(i)+".nc","r")
>   times  = *wrf_user_list_times*(f1)  ; get times in the file
>
>   ntimes = dimsizes <https://www.ncl.ucar.edu/Document/Functions/Built-in/dimsizes.shtml>(times<https://www.ncl.ucar.edu/Document/Functions/Built-in/dimsizes.shtml%3e(times>)         ; number of times in the file(s)
> end do
>
> *Sincerely*
> *Ehsan*
>
> On Friday, December 4, 2020, 05:57:54 PM GMT+3:30, Anil Kumar - NOAA
> Affiliate via ncl-talk <ncl-talk at mailman.ucar.edu> wrote:
>
>
> Hi,
> I am trying to read multiple wrfout files. I am reading okay..no problem
> with the code extracting variables.
> Problem comes, when each file has multiple times in it and then I don't
> know how to extract the time series of variables .
> Below is the code, please let me know how to modify code to read many
> times within each file.
> ************************
> fs1 = systemfunc("ls ../WRFV3/run/wrfout_d01*")
>  nfs1= dimsizes(fs1)
>  f1 = addfiles(fs1+".nc","r")
>   ntimes1 =  dimsizes(f1)         ; number of times in the file(s)
>
> loc1 = wrf_user_ij_to_ll(f1, 593., 546., True)
>  print("lon/lat locations are: " + loc)
> uu1      = new((/ntimes1/),float)
> vv1      = new((/ntimes1/),float)
> psfc1      = new((/ntimes1/),float)
> i1=0
> do while (i1.le.ntimes1-1)
> uu1(i1)    = f1[i1]->U(:,0,546,593)   ; (time, lat,lon)    ; (2,64,128)
> vv1(i1)    = f1[i1]->V(:,0,546,593)        ; V10(:,29.301,-94.797)
> psfc1(i1)  = f1[i1]->PSFC(:,546,593)
> i1 = i1 + 1
> end do
>    model_wspd1 = sqrt(uu1^2+vv1^2) ;wind_speed(uu,vv)
>    model_wdir1 = wind_direction(uu1,vv1,0)
>    model_psfc1 = psfc1/100.
> ************************
> --
> Dr. Anil Kumar
> Environmental Modeling Center/NCEP/NWS/NOAA
> College Park, MD, USA
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>


--
Dr. Anil Kumar
Environmental Modeling Center/NCEP/NWS/NOAA
College Park, MD, USA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201204/f6a4a763/attachment-0001.html>

------------------------------

Message: 8
Date: Fri, 4 Dec 2020 13:05:47 -0500
From: Anil Kumar - NOAA Affiliate <anil.kumar at noaa.gov>
To: Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com>
Cc: Ncl-talk <ncl-talk at ucar.edu>
Subject: Re: [ncl-talk] wrfout file reading
Message-ID:
        <CA+8gui8kW-L=eBdVhSv6BK5fXgdanjfRg_118O+TRXUozYQ8UQ at mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Yes, Hourly wrf outputs.

and yes when I extract times using *wrf_user_list_times*(f1) that works
fine but only times.
but how to extract variables like U10 time series?

Thanks,
Anil



On Fri, Dec 4, 2020 at 12:42 PM Ehsan Taghizadeh <ehsantaghizadeh at yahoo.com>
wrote:

> Dear Dr. Anil
> Are your wrfout files hourly?
> However, why you don't use wrf_user_list_times to extract the list of
> available times?
>
> fs1 = systemfunc("ls ../WRFV3/run/wrfout_d01*")
> nfs1= dimsizes(fs1)
> do i = 0, nfs1-1
>     f1 = addfile(fs1(i)+".nc","r")
>   times  = *wrf_user_list_times*(f1)  ; get times in the file
>
>   ntimes = dimsizes <https://www.ncl.ucar.edu/Document/Functions/Built-in/dimsizes.shtml>(times<https://www.ncl.ucar.edu/Document/Functions/Built-in/dimsizes.shtml%3e(times>)         ; number of times in the file(s)
> end do
>
> *Sincerely*
> *Ehsan*
>
> On Friday, December 4, 2020, 05:57:54 PM GMT+3:30, Anil Kumar - NOAA
> Affiliate via ncl-talk <ncl-talk at mailman.ucar.edu> wrote:
>
>
> Hi,
> I am trying to read multiple wrfout files. I am reading okay..no problem
> with the code extracting variables.
> Problem comes, when each file has multiple times in it and then I don't
> know how to extract the time series of variables .
> Below is the code, please let me know how to modify code to read many
> times within each file.
> ************************
> fs1 = systemfunc("ls ../WRFV3/run/wrfout_d01*")
>  nfs1= dimsizes(fs1)
>  f1 = addfiles(fs1+".nc","r")
>   ntimes1 =  dimsizes(f1)         ; number of times in the file(s)
>
> loc1 = wrf_user_ij_to_ll(f1, 593., 546., True)
>  print("lon/lat locations are: " + loc)
> uu1      = new((/ntimes1/),float)
> vv1      = new((/ntimes1/),float)
> psfc1      = new((/ntimes1/),float)
> i1=0
> do while (i1.le.ntimes1-1)
> uu1(i1)    = f1[i1]->U(:,0,546,593)   ; (time, lat,lon)    ; (2,64,128)
> vv1(i1)    = f1[i1]->V(:,0,546,593)        ; V10(:,29.301,-94.797)
> psfc1(i1)  = f1[i1]->PSFC(:,546,593)
> i1 = i1 + 1
> end do
>    model_wspd1 = sqrt(uu1^2+vv1^2) ;wind_speed(uu,vv)
>    model_wdir1 = wind_direction(uu1,vv1,0)
>    model_psfc1 = psfc1/100.
> ************************
> --
> Dr. Anil Kumar
> Environmental Modeling Center/NCEP/NWS/NOAA
> College Park, MD, USA
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at mailman.ucar.edu
> List instructions, subscriber options, unsubscribe:
> https://mailman.ucar.edu/mailman/listinfo/ncl-talk
>


--
Dr. Anil Kumar
Environmental Modeling Center/NCEP/NWS/NOAA
College Park, MD, USA
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201204/4a7be921/attachment-0001.html>

------------------------------

Subject: Digest Footer

_______________________________________________
ncl-talk mailing list
ncl-talk at mailman.ucar.edu
List instructions, subscriber options, unsubscribe:
https://mailman.ucar.edu/mailman/listinfo/ncl-talk

------------------------------

End of ncl-talk Digest, Vol 205, Issue 5
****************************************

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201205/ddbc9248/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 6B57029C99184E59976BE6606EA02A83.png
Type: image/png
Size: 827 bytes
Desc: 6B57029C99184E59976BE6606EA02A83.png
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201205/ddbc9248/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 5070BC9563F448D3BEE04BF94C48567B.png
Type: image/png
Size: 805 bytes
Desc: 5070BC9563F448D3BEE04BF94C48567B.png
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201205/ddbc9248/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 9C93A62AE27A49CDA4E88C4EC7C77C5C.png
Type: image/png
Size: 920 bytes
Desc: 9C93A62AE27A49CDA4E88C4EC7C77C5C.png
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20201205/ddbc9248/attachment-0002.png>


More information about the ncl-talk mailing list