[ncl-talk] Need a clarification for "getMidMonDay" function in NCL

Dennis Shea shea at ucar.edu
Wed Jun 8 09:23:07 MDT 2022


Oops. My bad!  I did not document the function.
getMidMonDay is a utility function contained within the 'crop' library
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/crop.ncl"
====
The code is 'simple'

undef("getMidMonDay")
function getMidMonDay(time:numeric)
;
; utility function
; The input 'time' (seconds/hours/days since ...") has the middle of the
month
; This returns the (*approximate*) 'middle day' of the current month as an
integer
; "Approximate" because day 15 is used for all months ...
;      rather than 14 (Feb), 14.5 (Leap year Feb) or 15.5 (31 day months).
; This is more than adequate.

local date, yyyy, mm, dd, jday
begin
    date = cd_calendar(time, 0)
    yyyy = toint(date(:,0))
    mm   = toint(date(:,1))

    dd   = conform(mm, 15, -1)    ; approx mid month

    jday = day_of_year(yyyy, mm, dd)

    copy_VarCoords(time, jday)
    jday at long_name = "mid-month day of current year"
    return(jday)
end

On Wed, Jun 8, 2022 at 3:43 AM Md. Jalal Uddin via ncl-talk <
ncl-talk at mailman.ucar.edu> wrote:

> Hi all,
>
> The fao56_1.ncl (https://www.ncl.ucar.edu/Applications/Scripts/fao56_1.ncl)
> script used "getMidMonDay" function to get the middle day of the month, but
> it seems that this function is not exist.
>
> How to get the middle day of the month to compute evapotranspiration? Is
> it similar to the "day_of_year" function (
> https://www.ncl.ucar.edu/Document/Functions/Built-in/day_of_year.shtml)?
>
> Regards,
> Jalal
> --
> *Md. Jalal Uddin*
> Founder and Director of Research Society
> PhD candidate - Atmospheric Physics and Atmospheric Environment (NUIST)
> M.Sc. in Applied Meteorology (NUIST)
> B.Sc. in Disaster Management (PSTU)
> Email: founder-and-director at researchsociety20.org,
> 20205103002 at nuist.edu.cn <dmjalal90 at nuist.edu.cn>
> Website: *https://researchsociety20.org/founder-and-director/
> <https://researchsociety20.org/founder-and-director/>*
> ResearchGate profile: https://www.researchgate.net/profile/Md_Uddin125
> YouTube channel:https://www.youtube.com/jalalsdream
> Cell: +8613260859092, +8801792052662
> _______________________________________________
> 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/20220608/876999d7/attachment.htm>


More information about the ncl-talk mailing list