[ncl-talk] ERA Interim [SEC=UNCLASSIFIED]

Dennis Shea shea at ucar.edu
Wed Dec 16 08:30:17 MST 2015


Hi Sandy,


[1]
Only the spherical harmonic (spherepack) function(s) uv2dvF, uv2dvG,
etc require the input data be S->N and global. The uv2dv_cfd function
is more robust. It allows regional grids and does not require the data
to be reordered. As you see from your output, the sample output,  'dv'
and 'dvR' are the same.

uv2dv_cfd uses simple centered finite differencing to get the result.
The equation used is from the Haltiner & Martin text book. It includes
a factor for the convergence of the meridians.

SIDE POINT: *IF* the data had been global, the spherical harmonic
functions would be recommended. They are "highly accurate." If you
look at Example 5  at http://www.ncl.ucar.edu/Applications/wind.shtml
you will not 'see' any difference due to the contour interval used.

[2]
You are setting the 'boundOpt' argument incorreectly. optBound=3 means
the data are cyclic in longitude. Your longitudes are regional not
cyclic.
        longitude: [69.75..290.25]
You should be using 2. Specifically:
        dv = uv2dv_cfd (u,v,u&latitude,u&longitude, 2)

[3]

You mention ...

       MFC = -del.(qV) = -u(dq/dx) -v(dq/dy)-q(du/dx+dv/dy)

       I think you could do this with

       uq = u*q
       vq = v*q
       del_qV = -uv2dv_cfd (uq,vq,u&latitude,u&longitude, 2)
D

On Tue, Dec 15, 2015 at 11:58 PM, Sandra Richard
<srichard at student.unimelb.edu.au> wrote:
> HI Dennis and EunPa,
>
> Thank you for your help and time. I am working with ERA Interim data with a
> smaller domain (not a global dataset)
>
> I'm trying to calculate Moisture Flux Convergence. Given by equation
>
> MFC = -del.(qV) = -u(dq/dx) -v(dq/dy)-q(du/dx+dv/dy)
>
> I saw that a few people posted about this calculation
>
> uv2dv_cfd (qu,qv)
>
> I tried but the output is not comparable to previous output from other paper
> using the same dataset but run with Ferret.
> I also tried to reverse the data from N-S to S-N...but there result is the
> same no matter if I reversed it or not.
>
> Any idea what went wrong? Sorry for the lengthy email. I include my script
> and the output for your reference.
>
> Here is a sample of my calculation for just divergence term (du/dx+dv/dy)
>
> Sample of my script:
>
> ;**********************************************************
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> ;**********************************************************
>
> begin
>
> ;******************************************************
> ; open file and read in data: data are on a Fixed Grid
> ;******************************************************
>    lv = 850
>
>   f    = addfile ("d.nc", "r")
>   d    = short2flt(f->d(:419,{lv},:,:))
>   delete (f)
>
>   f    = addfile ("u.nc", "r")
>   u    = short2flt(f->u(:419,{lv},:,:))
>   delete (f)
>
>   f    = addfile ("v.nc", "r")
>   v    = short2flt(f->v(:419,{lv},:,:))
>   delete (f)
>
> dv = uv2dv_cfd (u,v,u&latitude,u&longitude, 3)
>
> copy_VarCoords(u,dv)
>
>   u = u(:,::-1,:)   ; reorder
>   v = v(:,::-1,:)   ; reorder
>   d = d(:,::-1,:)   ; reorder
>
>   dvR = uv2dv_cfd (u,v,u&latitude,u&longitude, 3)
>
>  copy_VarCoords(u,dvR)
>
> print(dv(:,{10},{100})+"   "+dvR(:,{10},{100}))
> exit
>
>
> OUTPUT:
>
> Variable: dv
> Type: float
> Total Size: 47082000 bytes
>             11770500 values
> Number of Dimensions: 3
> Dimensions and sizes:   [time | 420] x [latitude | 95] x [longitude | 295]
> Coordinates:
>             time: [692496..998568]
>             latitude: [35.25..-35.25]
>             longitude: [69.75..290.25]
> Number Of Attributes: 1
>   _FillValue :  -32767
>
> Variable: dvR
> Type: float
> Total Size: 47082000 bytes
>             11770500 values
> Number of Dimensions: 3
> Dimensions and sizes:   [time | 420] x [latitude | 95] x [longitude | 295]
> Coordinates:
>             time: [692496..998568]
>             latitude: [-35.25..35.25]
>             longitude: [69.75..290.25]
> Number Of Attributes: 1
>   _FillValue :  -32767
> (0)     -2.57522e-06   -2.57522e-06
> (1)     -1.4823e-06   -1.4823e-06
> (2)     1.78249e-06   1.78249e-06
> (3)     -5.10952e-07   -5.10952e-07
> (4)     -3.59093e-06   -3.59093e-06
> (5)     -1.69175e-06   -1.69175e-06
> (6)     -6.31406e-06   -6.31406e-06
> (7)     -2.40177e-06   -2.40177e-06
> (8)     -3.81135e-06   -3.81135e-06
> (9)     5.15474e-07   5.15474e-07
> (10)    4.42615e-06   4.42615e-06
> (11)    2.44277e-06   2.44277e-06
> (12)    -1.52741e-06   -1.52741e-06
> (13)    -1.61721e-06   -1.61721e-06
> (14)    -9.01912e-07   -9.01912e-07
> (15)    -1.3066e-06   -1.3066e-06
> (16)    -2.85277e-06   -2.85277e-06
> (17)    -4.49877e-06   -4.49877e-06
> (18)    -4.96621e-06   -4.96621e-06
> (19)    -4.83259e-06   -4.83259e-06
> (20)    -3.54562e-06   -3.54562e-06
>
>
> Thank you for your time and help.
>
> Cheers,
> Sandy
>
>
>
>
>
> On 16 December 2015 at 11:33, Eun-Pa Lim <E.Lim at bom.gov.au> wrote:
>>
>> Dear Dennis,
>>
>> Thanks a lot for your reply to Sandy!!
>>
>> Best regards,
>>
>> Eunpa
>>
>>
>>
>> Eun-Pa Lim
>> Research Scientist
>> Seasonal Prediction Science Team
>> Centre for Australian Weather and Climate Research (CAWCR)
>> Bureau of Meteorology
>> Tel: +61-3-9669-4636
>> http://www.cawcr.gov.au/staff/elim/index.php
>>
>> -----Original Message-----
>> From: Dennis Shea [mailto:shea at ucar.edu]
>> Sent: Wednesday, 16 December 2015 7:34 AM
>> To: Eun-Pa Lim
>> Cc: Sandra Richard; ncl-talk at ucar.edu
>> Subject: Re: [ncl-talk] ERA Interim [SEC=UNCLASSIFIED]
>>
>> Hello,
>>
>> Sorry for the delay....
>>
>> As indicated in the documentation, the uv2dvF functions uses the fortran
>> based 'Spherepack' (spherical harmonics) to calculate the divergence. See:
>>      http://www2.cisl.ucar.edu/resources/legacy/spherepack
>>
>> The code is not 'simple' and for 'casual' viewing.   :-(
>> In addition, NCL uses a C-based interface to the fortran subroutines.
>> More complicated!
>>
>> ===
>>
>> The NCL function *requires* that the data be ordered South->North. I think
>> ERA-Interim is ordered North->South. You can use NCL syntax to reverse the
>> order quite easily.
>>
>>    f = addfile(...)
>>    u = f->U            ; ? (time,level,lat,lon) ?
>>
>>    u = u(:,:,::-1,:)   ; reorder
>>
>> Same for 'v'
>>
>> ====
>> There is a simple finite difference based function that could be used
>>
>> http://www.ncl.ucar.edu/Document/Functions/Built-in/uv2vr_cfd.shtml
>>
>> Assorted examples are at:
>>    http://www.ncl.ucar.edu/Applications/wind.shtml
>> See:
>>    Example 5
>>
>> Hope this helps.
>>
>> D
>>
>>
>>
>> On Mon, Dec 7, 2015 at 9:57 PM, Eun-Pa Lim <E.Lim at bom.gov.au> wrote:
>> > Hi Sandy,
>> >
>> >
>> >
>> > Have you tried the comparison for one day?
>> >
>> >
>> >
>> > I can't find the actual code for uv2dvF. If you really need it, you
>> > can send an email to ncl-talk at ucar.edu.
>> >
>> >
>> >
>> > Also, if I were you, I would try to calculate the divergence manually
>> > du/dx+dv/dy.
>> >
>> >
>> >
>> >
>> >
>> > Sorry, I'm not very helpful !!
>> >
>> >
>> >
>> > Eun-Pa Lim
>> >
>> > Research Scientist
>> >
>> > Seasonal Prediction Science Team
>> >
>> > Centre for Australian Weather and Climate Research (CAWCR)
>> >
>> > Bureau of Meteorology
>> >
>> > Tel: +61-3-9669-4636
>> >
>> > http://www.cawcr.gov.au/staff/elim/index.php
>> >
>> >
>> >
>> > From: Sandra Richard
>> > Sent: Tuesday, 8 December 2015 3:33 PM
>> > To: Eun-Pa Lim
>> > Subject: ERA Interim
>> >
>> >
>> >
>> > Hi Eun Pa,
>> >
>> >
>> >
>> > Sorry, I got another question for you...
>> >
>> >
>> >
>> > I understand that there is "divergence" field in ERA Interim dataset.
>> > I guess it must be showing horizontal divergence (du/dx+dv/dy)right?
>> >
>> > I tried to compare the output of January 1979 divergence plot (which
>> > have been calculated in ERA Interim) and the calculation using NCL
>> > (uv2dvf) for the same data (Jan 79). I've attached the script I use
>> > for calculating divergence using uv2dvf. However the output is totally
>> > different. Any thoughts?
>> >
>> > Do you know where I can get the script for this NCL function uv2dvf to
>> > see what it is calculating?
>> >
>> >
>> >
>> > Thanks.
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > ________________________________
>> >
>> > From: Eun-Pa Lim
>> > Sent: Monday, December 7, 2015 7:23 PM
>> > To: Sandra Richard
>> > Subject: RE: Hello from Kota Kinabalu, Malaysia [SEC=UNCLASSIFIED]
>> >
>> >
>> >
>> > Ah, that's sweet!!   You take care of yourself, too :-D
>> >
>> >
>> >
>> >
>> >
>> > Eun-Pa Lim
>> >
>> > Research Scientist
>> >
>> > Seasonal Prediction Science Team
>> >
>> > Centre for Australian Weather and Climate Research (CAWCR)
>> >
>> > Bureau of Meteorology
>> >
>> > Tel: +61-3-9669-4636
>> >
>> > http://www.cawcr.gov.au/staff/elim/index.php
>> >
>> >
>> >
>> > From: Sandra Richard
>> > Sent: Monday, 7 December 2015 7:20 PM
>> > To: Eun-Pa Lim
>> > Subject: Re: Hello from Kota Kinabalu, Malaysia [SEC=UNCLASSIFIED]
>> >
>> >
>> >
>> > Hi EunPa,
>> >
>> >
>> >
>> > Yes, this is the website I'm looking for.
>> >
>> >
>> >
>> > I don't think I've seen you work "less than hard" :)
>> >
>> >
>> >
>> > Take care. I miss you already!
>> >
>> >
>> >
>> >
>> >
>> > ________________________________
>> >
>> > From: Eun-Pa Lim
>> > Sent: Monday, December 7, 2015 7:08 PM
>> > To: Sandra Richard
>> > Subject: RE: Hello from Kota Kinabalu, Malaysia [SEC=UNCLASSIFIED]
>> >
>> >
>> >
>> > Hi Sandy!!
>> >
>> >
>> >
>> > It's nice to hear from you!  Is it nice to be back?? Your family and
>> > colleagues must be excited to see you :-D
>> >
>> > I'm glad you liked Max Lucado's book – I liked it as it has many
>> > analogies I can associated with.
>> >
>> >
>> >
>> > Is this what you are after? - climate explorer:
>> > http://climexp.knmi.nl/
>> >
>> >
>> >
>> > If you need any help you think I could offer, please feel free to send
>> > me emails. This week is not a social week, so I'll be here working
>> > "hard"!
>> >
>> >
>> >
>> > Cheers
>> >
>> >
>> >
>> > Eunpa
>> >
>> >
>> >
>> > Eun-Pa Lim
>> >
>> > Research Scientist
>> >
>> > Seasonal Prediction Science Team
>> >
>> > Centre for Australian Weather and Climate Research (CAWCR)
>> >
>> > Bureau of Meteorology
>> >
>> > Tel: +61-3-9669-4636
>> >
>> > http://www.cawcr.gov.au/staff/elim/index.php
>> >
>> >
>> >
>> > From: Sandra Richard
>> > Sent: Monday, 7 December 2015 6:57 PM
>> > To: Eun-Pa Lim
>> > Subject: Hello from Kota Kinabalu, Malaysia
>> >
>> >
>> >
>> > Hi EunPa,
>> >
>> >
>> >
>> > How are you? Hope everything is well with you there. Thank you for the
>> > birthday treat and the present. I love that book you gave me.
>> >
>> >
>> >
>> > I'm starting to do my work at the Malaysian Meteorological Department
>> > today.
>> > Expected to come in  the office every day. It's a bit harder because I
>> > do not have a walking library/reference (you!) here. Hahaha!
>> >
>> >
>> >
>> > Anyway, I wanted to ask you about the website where I can see the
>> > output of the reanalysis. I remember the other day you show me a
>> > website that shows the SST during each month. I lost the link when my
>> > laptop was formatted by uni staff :(.
>> >
>> >
>> >
>> > Thanks!
>> >
>> >
>> >
>> > Keep in touch.
>> >
>> >
>> >
>> > Cheers, Sandy
>> >
>> >
>> > _______________________________________________
>> > ncl-talk mailing list
>> > ncl-talk at ucar.edu
>> > List instructions, subscriber options, unsubscribe:
>> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>> >
>
>


More information about the ncl-talk mailing list