<html><head><meta http-equiv="content-type" content="text/html; charset=us-ascii"><style>body { line-height: 1.5; }body { font-size: 10.5pt; font-family: ??; color: rgb(0, 0, 0); line-height: 1.5; }</style></head><body>
<table width="99.99%" height="100%" style="padding: 10px; background-color: transparent;" border="0" cellpadding="0" cellspacing="0" background="cid:_Foxmail.1@36b61ecc-955c-3d1e-646c-7dbafd62b1ce">
<tbody><tr>
<td valign="top" style="width:100%;height:100%;">
<div style="">
<div><span></span><br></div>
<div><span style="font-size: 16px; background-color: rgba(0, 0, 0, 0);">i'm processing merra-land daily production, the variable latitude and longitude are both double.
<br>the below  is my code :
<br>
<br>+++++++++++++++++++++++++++++++++++++++++++++++++++
<br>     1  load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
<br>     2  load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
<br>     3  load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
<br>     4  load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
<br>     5
<br>     6  begin
<br>     7     files = systemfunc("sh sortname.sh")
<br>     8     setfileoption("nc","Format","LargeFile")
<br>     9     fallvars = addfiles(files,"r")
<br>    10     ListSetType(fallvars,"cat")
<br>    11     runoff   = fallvars[:]-&gt;runoff
<br>    12     slat = fallvars[:]-&gt;latitude(0:360)
<br>    13     slon = fallvars[:]-&gt;longitude(0:539)
<br>    14
<br>    15     dims=dimsizes(runoff)
<br>    16
<br>    17     lat=new((/dims(1)/),float,"No_FillValue")
<br>    18     lon=new((/dims(2)/),float,"No_FillValue")
<br>    19     time=new((/dims(0)/),integer,"No_FillValue")
<br>    20     srunoff=new((/dims(2),dims(1),dims(0)/),float,runoff@_FillValue)
<br>    21
<br>    22     lon!0="lon"
<br>    23     lon@long_name="longitude"
<br>    24     lon@units="degrees-east"
<br>    25     lon=tofloat(slon)
<br>    26     print(slon(0)+" "+slon(539))
<br>    27     print(lon(0)+" "+lon(539))
<br>    28
<br>    29     lat!0="lat"
<br>    30     lat@long_name="latitude"
<br>    31     lat@units="degrees-north"
<br>    32     lat=tofloat(slat)
<br>    33
<br>    34     time!0="time"
<br>    35     time@long_name="time"
<br>    36     time@units="days since 1980-1-1 0"
<br>    37     time=yyyymm_time(1980,2013,"integer")
<br>    38
<br>    39     srunoff!0="lon"
<br>    40     srunoff!1="lat"
<br>    41     srunoff!2="time"
<br>    42     srunoff&amp;lon=lon
<br>    43     srunoff&amp;lat=lat
<br>    44     srunoff&amp;time=(/time/)
<br>    45     srunoff@units = "kg.m-2.s-1"
<br>    46     srunoff@long_name = "Overland runoff"
<br>    47     ;srunoff=(/runoff(longitude|:,latitude|:,time|:)/)
<br>    48     do i=0,dims(0)-1
<br>    49         do j=0,dims(1)-1
<br>    50            do k=0,dims(2)-1
<br>    51                srunoff(k,j,i)=(/runoff(i,j,k)/)
<br>    52            end do
<br>    53         end do
<br>    54    end do
<br>    55
<br>    56     printVarSummary(runoff)
<br>    57     printVarSummary(srunoff)
<br>    58  end
<br>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
<br>in the line 25,32,37, if i change them with the following fashion:
<br>
<br>lon&amp;lon=tofloat(slon)
<br>lat&amp;lat=tofloat(slat)
<br>time&amp;time=yyyymm_time(1980,2013,"integer")
<br>
<br>then, the wrong result will generate from line 26 and 27,
<br>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<br>
<br>(0)     -180 179.3333282470703
<br>(0)     -254807 0
<br>
<br>......
<br>
<br>Variable: srunoff
<br>Type: float
<br>Total Size: 318142080 bytes
<br>            79535520 values
<br>Number of Dimensions: 3
<br>Dimensions and sizes:   [lon | 540] x [lat | 361] x [time | 408]
<br>Coordinates:
<br>            lon: [-180..179.3333]
<br>            lat: [-90..90]
<br>            time: [-931605192..0]
<br>Number Of Attributes: 3
<br>  long_name :   Overland runoff
<br>  units :       kg.m-2.s-1
<br>  _FillValue :  1e+15
<br>
<br>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<br><br>if i change them with direct assignment, like the line 25,32,37,the right result will appear
<br>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<br>(0)     -180 179.3333282470703
<br>(0)     -180 179.333
<br>
<br>
<br>Variable: srunoff
<br>Type: float
<br>Total Size: 318142080 bytes
<br>            79535520 values
<br>Number of Dimensions: 3
<br>Dimensions and sizes:   [lon | 540] x [lat | 361] x [time | 408]
<br>Coordinates:
<br>            lon: [-180..179.3333]
<br>            lat: [-90..90]
<br>            time: [198001..201312]
<br>Number Of Attributes: 3
<br>  long_name :   Overland runoff
<br>  units :       kg.m-2.s-1
<br>  _FillValue :  1e+15
<br> 
<br>++++++++++++++++++++++++++++++++++++++++++++++++++++++++
<br>
<br>i want to know why the "lon&amp;lon, lat&amp;lat, time&amp;time" style gave wrong results?
<br>
<br>thanks</span></div><hr style="width: 210px; height: 1px;" color="#b5c4df" size="1" align="left">
<div><span><div style="FONT-FAMILY: verdana; FONT-SIZE: 10pt">
<div>dyjbean@gmail.com</div></div></span></div>
<div></div></div>
</td>
</tr>
</tbody></table>
</body></html>