<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.m2935617508547806091msonospacing, li.m2935617508547806091msonospacing, div.m2935617508547806091msonospacing
{mso-style-name:m_2935617508547806091msonospacing;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="HU" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Dear Adam,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Thank you for your suggestion. I fixed the bug in crop.ncl and it works correctly.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Best regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US">Beata<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:"Calibri",sans-serif"> Adam Phillips [mailto:asphilli@ucar.edu]
<br>
<b>Sent:</b> Thursday, October 05, 2017 6:04 PM<br>
<b>To:</b> Beáta Szabó-Takács <szabo.b@czechglobe.cz><br>
<b>Cc:</b> ncl-talk (ncl-talk@ucar.edu) <ncl-talk@ucar.edu><br>
<b>Subject:</b> Re: [ncl-talk] daylight_fao56 function error<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi Beata,<o:p></o:p></p>
<div>
<p class="MsoNormal">I think you have found a bug in crop.ncl. I would suggest copying crop.ncl to your local directory, modifying line 779 from this:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">daylightmax(:,nl) = con*ws ; eq 34<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">to this:<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">daylightmax(:,nl,ml) = con*ws ; eq 34<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">and then loading your version of crop.ncl at the top of your script. If that does not work let ncl-talk know. I will file a JIRA ticket for this. <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Adam<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">On Wed, Oct 4, 2017 at 4:28 AM, Beáta Szabó-Takács <<a href="mailto:szabo.b@czechglobe.cz" target="_blank">szabo.b@czechglobe.cz</a>> wrote:<o:p></o:p></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Dear NCL Users,<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I have a matter with daylight_fao56 function. I have a lat(nlat,mlon) and doy(ntime) variables what I used in daylight_fao56 function but I got an error message:
<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">fatal:Number of subscripts (2) and number of dimensions (3) do not match for variable (daylightmax)<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">fatal:["Execute.c":8640]:Execute: Error occurred at or near line 779 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/crop.ncl<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">fatal:["Execute.c":8640]:Execute: Error occurred at or near line 48 in file ex_regrid_ETo_turc.ncl<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">My script:<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="m2935617508547806091msonospacing">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"<o:p></o:p></p>
<p class="m2935617508547806091msonospacing">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"<o:p></o:p></p>
<p class="m2935617508547806091msonospacing">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<o:p></o:p></p>
<p class="m2935617508547806091msonospacing">load "$NCARG_ROOT/lib/ncarg/nclscripts/contrib/calendar_decode2.ncl"<o:p></o:p></p>
<p class="m2935617508547806091msonospacing">load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/crop.ncl"<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> <o:p></o:p></p>
<p class="m2935617508547806091msonospacing">begin<o:p></o:p></p>
<p class="m2935617508547806091msonospacing">;-- open file<o:p></o:p></p>
<p class="m2935617508547806091msonospacing">a = addfile("<a href="http://CNRM-CM5-CLM4.8.171971.nc" target="_blank">CNRM-CM5-CLM4.8.171971.nc</a>","r") ;read the nc file<o:p></o:p></p>
<p class="m2935617508547806091msonospacing">b = addfile("sund_CNRM-CM5-CLM1971.nc","r")<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> <o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> tas = a->tas ; read daily tasmax values<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> sund = b->sund ; read daily sund values<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> <o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> time = a->time ; read time values<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> time_bnds = a->time_bnds<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> lat = a->lat<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> lon = a->lon<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> lon_bnds = a->lon_bnds<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> lat_bnds = a->lat_bnds<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> rlon = a->rlon<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> rlat = a->rlat<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> rotated = a->rotated_latitude_longitude<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> <o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> print(lat)<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> tmean = tas + 273.15 ; convert K to Celsius degree<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> nsun = sund/3600 ; convert second to hour<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> time2 = calendar_decode2(time,-5) ; convert the time codes (days since 1949,12,1) to yyyy,mm,dd in integer<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> <o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> doy = day_of_year(time2(:,0),time2(:,1),time2(:,2)) ; calculate day of year<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> print (doy)<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> <o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> ra_0 = radext_fao56(doy, lat, 0) ; Compute extraterrestrial radiation for daily periods<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> ra_0 = where(ismissing(ra_0), 0, ra_0) ; convert the missing value due to limited validity at high latitudes to 0<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> print(ra_0)<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> <o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> sunhrx = daylight_fao56(doy, lat) ; max daylight/sun; hr per day<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> print(sunhrx)<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> <o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> rs_0 = radsol_fao56(ra_0, sunhrx, nsun, (/0,0/), False) ; 'radsol' (total solar radiation)<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> evturc_0 = refevt_turc( tmean, rs_0, (/0,0,0/) ) ; Turc ETo formulation in mm/day<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> <o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> out1 = addfile("CNRM-CM5_CLM_evturc_<a href="http://01.nc">01.nc</a>","c") ; write ETo to netCDF file<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> out1->evturc = evturc_0<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> out1->evturc!0 = "time"<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> out1->evturc!1 = "rlat"<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> out1->evturc!2 = "rlon"<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> out1->lat = lat<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> out1->lat_bnds = lat_bnds<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> out1->lon = lon<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> out1->lon_bnds = lon_bnds<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> out1->rlon = rlon<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> out1->rlat = rlat<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> out1->rotated_pole = rotated<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> out1->time = time<o:p></o:p></p>
<p class="m2935617508547806091msonospacing"> out1->time_bnds = time_bnds<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">end<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">According to my best knowledge radext_fao56 and daylight_fao56 functions use same variables (jday and lat). The radext function works correctly but daylight function does not. Could
someone write me what I did wrong and how I can fix this error? Thank you very much for your help in advance!<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Beata<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><br>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">-- <o:p></o:p></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal"><span style="color:#888888">Adam Phillips </span><o:p></o:p></p>
</div>
<p class="MsoNormal"><span style="color:#888888">Associate Scientist, Climate and Global Dynamics Laboratory, NCAR</span><o:p></o:p></p>
</div>
</div>
<div>
<p class="MsoNormal"><span style="color:#888888"><a href="http://www.cgd.ucar.edu/staff/asphilli/" target="_blank">www.cgd.ucar.edu/staff/asphilli/</a> 303-497-1726
</span><o:p></o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>