[ncl-talk] Reading multiple hdf-eos files in an array

Abdulla Sakalli as at abdulla-sakalli.com
Wed Dec 9 05:13:55 MST 2015


Dear List,

I downloaded 20 files from MODIS satellite for NPP (MOD17A3). I’d like to read the hdf files and merge it in 4x5 to get the NPP value for pan-European domain. I've been written the fallowing script for my aim. Unfortunately, I get the files merged in 1x20 (i.e. merged along latitude and not lonxlat direction).
Can please anyone help me to read the npp from the 20 files and enlarge it in LonxLat direction.

Thank you very much in advance
Abu

Script:



load "$NCARG_ROOT/share/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/share/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/share/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/share/ncarg/nclscripts/csm/shea_util.ncl"

begin

; 1km annual npp MOD17A3 on 1200x1200 tiles

files = systemfunc("ls *.hdfeos")

f = addfiles(files,"r")
;print(f)
;ListSetType (f, "cat") ;concatenate files

lat2d=f[:]->GridLat_MOD_Grid_MOD17A3
lon2d=f[:]->GridLon_MOD_Grid_MOD17A3

npp=short2flt(f[:]->Npp_1km_MOD_Grid_MOD17A3)

lat2d!0="nlat"
lat2d!1="nlon"
lon2d!0="nlat"
lon2d!1="nlon"

;printVarSummary(lon2d)

npp!0="lat2d"
npp!1="lon2d"
npp&lat2d=lat2d
npp&lon2d=lon2d
npp at coordinates="lat2d,lon2d"
npp at projection="sinusoidal"

printVarSummary(npp)

system("rm test.nc")
out=addfile("test.nc","c")
out->npp=npp
out->lat2d=lat2d
out->lon2d=lon2d

end

print summary is

Variable: npp
Type: short
Total Size: 57600000 bytes
            28800000 values
Number of Dimensions: 2
Dimensions and sizes:    [YDim_MOD_Grid_MOD17A3 | 24000] x [XDim_MOD_Grid_MOD17A3 | 1200]
Coordinates: 
Number Of Attributes: 6
  lon2d :    <ARRAY of 28800000 elements>
  lat2d :    <ARRAY of 28800000 elements>
  coordinates :    lat2d,lon2d
  hdfeos_name :    Npp_1km
  projection :    sinusoidal
  unsigned :    True


---------------------------------------------------------------------------
Asst. Prof. Abdulla Sakalli

Iskenderun Technical University
Faculty of Marine Sciences & Technology
Dept. Water Resources Management and Organization
Meydan Mah. 512 Sk
Iskenderun-Hatay-Turkey
as at abdulla-sakalli.com <http://www.abdulla-sakalli.com/>
asakalli at istek.edu.tr <mailto:asakalli at mku.edu.tr>
+90 326 614 1693 (330)
+90 536 506 9191







-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151209/d361f246/attachment.html 


More information about the ncl-talk mailing list