begin ;read wrfinput file to get corresponding latitude and lontiude for the netcdf needed to be changed f_latlon = addfile("~/Data/WUS_domain/wrfinput_d01", "r") latitude = wrf_user_getvar(f_latlon, "XLAT", 0) longitude = wrf_user_getvar(f_latlon, "XLONG", 0) nlats = dimsizes(latitude(:,0)) nlons = dimsizes(longitude(0,:)) lat = fspan(latitude(0,0),latitude(nlats-1,0), nlats) lon = fspan(longitude(0,0), longitude(0,nlons-1), nlons) lon!0 = "lon" lon@long_name = "lon" lon@units = "degrees_east" lon&lon = lon lat!0 = "lat" lat@long_name = "lat" lat@units = "degrees_north" lat&lat = lat dir1 = "~/Data/hrldas_wus/" dir2 = "~/Data/SPOT_FCOVER/" ; use do loop to get my filename do i=0,5113 i@units = "days since 1999-01-01" utc_date = cd_calendar(i, 2) extension = "00.LDASIN_DOMAIN1" ;the vegetation fraction file has latitude nad longitude fn = str_get_cols(utc_date, 0, 5)+"_0125.nc" f_cover = addfile(dir2+fn, "r") fcover = f_cover->FCOVER ; the file will be change. The vegetation fraction in this file has south_north and west_east attributes, which can give me location information f = addfile(dir1+utc_date+extension, "w") vegfra = f->VEGFRA printVarSummary(vegfra) do y = 0,158 do x = 0,198 lat_y = lat(y) lon_x = lon(x) temp = fcover(0,{lat_y:lat_y},{lon_x:lon_x}) vegfra(0,y,x) = temp end do end do f->VEGFRA = vegfra delete(f) delete(f_cover) delete(vegfra) delete(fcover) end do end