;; NCL_TALK: Stuart D Smith: Thu Nov 15, 2018 ;; ;;I am seeking guidance on creating a maximum value map using the information ;;from multiple satellite images. ;; ;;To create the map, I believe I would need to use NCL to iterate through a ;list of folders (each folder contains one MODIS image) and extract the maximum ;;value of flooded area for each grid cell. The final product would be a map ;;(NetCDF/ascii file) with the maximum flooded values for each grid cell. ;;The attached NetCDF file is an example of the file I would be reading in. ;; ;;I am new to NCL so I really didn’t know where to begin. ;;Any examples or reference material would be ;;greatly appreciated. ;;Thank you for your time. ;; ;;======================================================= ;; netcdf MWP_2009060_100W050N_2D2OT.fract_wet { ;; dimensions: ;; lon = 80 ; ;; lat = 80 ; ;; variables: ;; float Band1(lat, lon) ; ;;======================================================= dirp = "./" ; parent directory fils = systemfunc ("ls "+dirp+"MWP_*.nc") ; file paths nfil = dimsizes(fils) print("nfil="+nfil) f = addfiles (fils, "r") ; note the "s" of addfile ListSetType (f, "join") x = f[:]->Band1 ; read Band1 from all files printVarSummary (x) ; (nfils,80,80) ;; https://www.ncl.ucar.edu/Document/Functions/Built-in/dim_max_n.shtml xMax = dim_max_n_Wrap(x, 0) printVarSummary(xMax) printMinMax(xMax,0) ;; Write to netCDF: Simple method ;; https://www.ncl.ucar.edu/Applications/write_netcdf.shtml dirNc = "./" filNc = "NWP_MAX.nc" pthNc = dirNc + filNc system("/bin/rm -f "+pthNc) ; remove any pre-existing file ncdf = addfile(pthNc ,"c") ; open output netCDF file ;=================================================================== ; create global attributes of the file (optional) ;=================================================================== fAtt = True ; assign file attributes fAtt@title = "MODIS MAX" fAtt@Conventions = "None" fAtt@creation_date = systemfunc ("date") fileattdef( ncdf, fAtt ) ; copy file attributes ;=================================================================== ; output variables directly; NCL will call appropriate functions ; to write the meta data associated with each variable ;=================================================================== ncdf->BAND_MAX = xMax