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 dir = "~/Data/hrldas_wus/" ; 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 = "0100.LDASIN_DOMAIN1" ;the vegetation fraction file has latitude nad longitude file= str_get_cols(utc_date, 0, 5)+"_0125.nc" f_cover = addfile(dir+file, "r") fcover = f->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(dir+utc_date+extension, "w") vegfra = f->VEGFRA ;please define time dimension here for "vegfra!0" vegfra!1 = "lat" vegfra!2 = "lon" vegfra&lat = lat vegfra&lon = lon vegfra&lat@units = "degrees_north" vegfra&lon@units = "degrees_east" vegfra(0,:,:) = fcover(0,:,:) ; do y = 0,158 ; do x = 0,198 ; lat_y = lat(y) ; lon_x = lon(x); ; ; ;vegfra(0,x,y) ;fcover(0,{lat_x:lat_x},{lon_y:lon_y}) ; end do ; end do f->VEGFRA = vegfra delete(f) delete(f_cover) delete(vegfra) delete(fcover) end do end