;---Data are from some gridded source dirtxt = "./" filtxt = "var.txt" pthtxt = dirtxt+filtxt ncols = 8 nrows = numAsciiRow(pthtxt) values = asciiread(pthtxt,(/nrows,ncols/),"float") printVarSummary(values) print("=====") ;---After looking at the text file: ;---It is clear the data are on a rectilinear grid. ;---Extract pertient information. LAT = values(:,0) dLAT = 0.20 nlat = toint((max(LAT)-min(LAT))/dLAT)+1 LON = values(:,1) dLON = 0.20 mlon = toint((max(LON)-min(LON))/dLON)+1 print("GRID SIZE: ("+nlat+","+mlon+")") print("=====") ;---Create latitude and longitude coordinates lat = values(0::nlat,0) ; 1st column lat!0 = "lat" lat@units = "degrees_north" print(lat) lon = values(0:mlon-1,1) ; 2nd column lon!0 = "lon" lon@units = "degrees_east" print(lon) ;---Read variables; reshape onto grid srad = onedtond(values(:,2),(/nlat,mlon/)) tmax = onedtond(values(:,3),(/nlat,mlon/)) ; points for which interpolation required t lat_pts = (/10.38, 10.40/) lon_pts = (/79.85, 79.49/) ntmax = linint2_points_Wrap(lat,lon,tmax,False,lat_pts,lon_pts,0) print(ntmax)