[ncl-talk] Sub -Natgrid function help

Mary Haley haley at ucar.edu
Mon Jan 25 15:03:38 MST 2016


​You will have to do some debugging to figure this out, because without the
data files, we can't verify that you are passing valid arrays to natgird.

Did you actually look at lat, lon, lonn, and latt before you called natgrid
to make sure there are no missing values?

Here's what I suggest, to help you debug this problem. I'm just doing this
for the "lon" variable, but you should do it for all of them:

;---Add these lines before you call natgrid
printVarSummary(lon)        ; print information about the variable
printMinMax​(lon,0)          ; print the min / max of 'lon'
print("# of 'lon' missing values = " + num(ismissing(lon)))  ; count number
of missing values

​--Mary
​

On Mon, Jan 25, 2016 at 12:31 PM, Adv <advita6 at gmail.com> wrote:

> Hi,
> strll  = asciiread("stationmac.txt", -1, "string") ;
>   print(strll)   ; STATION","STATION_NAME", "LAT", "LON"
>   print("=====")
>
> sloc = str_get_field(strll , 2, ",")
>   lat  = tofloat( str_get_field(strll , 3, ",")  )
>   lon  = tofloat( str_get_field(strll , 4, ",")  )
>   print(sloc +" : "+lat+" "+lon)
> mnlat=(min(lat))
> mxlat=(max(lat))
> mnlon=(min(lon))
> mxlon=(max(lon))
> printVarSummary(lon)
> print(lon)
> print(lat)
> lon at _FillValue = -95.06125
> lat at _FillValue = 46.80
> print(lon)
> print(lat)
> print(mnlon)
> print(mxlon)
> print(mnlat)
> print(mxlat)
> mlon = 391
> dlon = -90.35 / mlon
> lonn  = fspan (-116, (mlon - 1) * dlon, mlon)
> print(lonn)
> mlat = 391
> dlat = 49.0 / mlat
> latt  = fspan (40.01, (mlat - 1) * dlat, mlat)
> print(latt)
> diri="dailysimms/prec-obs/"
> z1 = asciiread(diri+"tmax_avg_Jan1965-2005",-1,"float")
> ;print(z1)
> ;printVarSummary(z1)
> ;a = (/1,2,3,4,5,6,7,8/)
> ;390 rows by 50 columns
> ;390 rows by 41 columns
> a0 = onedtond(z1,(/391,41/))
> ;print(a0)
> x=dim_avg_n(a0,1)
> print(x)
> diri1="dailysimms/prec-obs/"
> z2 = asciiread(diri1+"tmin_avg_Jan1965-2005",-1,"float")
> ;print(z2)
> ;printVarSummary(z2)
> ;a = (/1,2,3,4,5,6,7,8/)
> ;390 rows by 50 columns
> ;390 rows by 41 columns
> a1 = onedtond(z2,(/391,41/))
> ;print(a1)
> y=dim_avg_n(a1,1)
> print(y)
> ;tenth of degree celcius
> s=(x+y)/20
> printVarSummary(s)
> print(s)
> ;return
> fo = natgrid(lon,lat,s,lonn, latt)
>
> The Error I encounter is fatal:natgrid: x cannot contain any missing values
>
> I replaced the missing value with digits. Then also why would I get this
> error? Could someone help me to fix this bug.
>
> Thank you
> Adv
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160125/79f7443b/attachment.html 


More information about the ncl-talk mailing list