[ncl-talk] Repost: Distortions while merging multiple modis hdf files

Krishnakumar AP krishnaap7 at gmail.com
Sat Jan 6 02:26:47 MST 2018


Thanks a lot Dennis and NCL community. That was really helpful. Thanks
again.

On Wed, Jan 3, 2018 at 7:58 AM, Dennis Shea <shea at ucar.edu> wrote:

> [1]  If you do:
>
> %> ncl_filedump xMOD06_L2.A2011349.0550.006.2015056134430.hdf | less
>
> You will see:
>
> [snip]
> Variable: f
> Type: file
> filename:       xMOD06_L2.A2011349.0550.006.2015056134430
> path:   xMOD06_L2.A2011349.0550.006.2015056134430.hdf
>    file global attributes:
>       HDFEOSVersion : HDFEOS_V2.17
>       StructMetadata_0 : GROUP=SwathStructure
>         GROUP=SWATH_1
>                 SwathName="mod06"
> [snip]
>
> So, these files contain satellite SWATH data
>
> [2] For convenience, when HDFEOS_V2 data are encountered, it is convenient
> to append the file suffix .he2 or, equivalently .hdfeos in the addfile(s)
> function. This makes for a 'cleaner'  look at the file. Further, in some
> cases, value added information is added. [Side point: for hdf5-eos use .he5)
>
> %> ncl_filedump xMOD06_L2.A2011349.0550.006.2015056134430.hdf.he2 | less
>
> You will see a different look. More like a classic netCDF file. Value
> added features include adding a 'coordinates' attribute to each variable.
>
> [3] While the dimension sizes and dimension names are the same for each
> swath file:
>
>    dimensions:
>       Cell_Across_Swath_5km_mod06 = 270
>       Cell_Along_Swath_5km_mod06 = 406
>
> The locations [ Latitude (Latitude_mod06) and Longitude (Longitude_mod06)]
> are different for each file.
>
> [4] Your use of
>
> f=addfiles(fils,"r")
> ListSetType(f,"cat")                ; this is the default
> cl = f[:]->Cloud_Top_Pressure
>
> is not appropriate. 'cat' mode is more appropriate when time(s) are
> changing but the physical locations for each file are the same. In your
> case, each swath has a different location imprint.
>
> In your case "join" would be more appropriate.
>
> f=addfiles(fils,"r")
> ListSetType(f,"join")                ; this is the default
> cl = f[:]->Cloud_Top_Pressure
>
> You will see a different look. More like a classic netCDF file. Value
> added features include adding a 'coordinates' attribute to each variable.
>
> [3] While the dimension sizes and dimension names are the same for each
> swath file:
>
>    dimensions:
>       Cell_Across_Swath_5km_mod06 = 270
>       Cell_Along_Swath_5km_mod06 = 406
>
> The locations [ Latitude (Latitude_mod06) and Longitude (Longitude_mod06)]
> are different for each file.
>
> [4] Your use of
>
> f=addfiles(fils,"r")
> ListSetType(f,"cat")                ; this is the default
> cl = f[:]->Cloud_Top_Pressure
>
> is not appropriate. 'cat' mode is more appropriate when time(s) are
> changing but the physical locations for each file are the same. In your
> case, each swath has a different location imprint.
>
> In your case "join" would be more appropriate.
>
> f=addfiles(fils,"r")
> ListSetType(f,"join")                ; this is the default
> cl = f[:]->Cloud_Top_Pressure
>
> printVarSummary(cl)   ; ALWAYS look at your data
>
> Variable: cl
> Type: short
> Total Size: 657720 bytes
>             328860 values
> Number of Dimensions: 3
> Dimensions and sizes:   [ncl_join | 3] x [Cell_Along_Swath_5km_mod06 |
> 406] x [Cell_Across_Swath_5km_mod06 | 270]
>   scale_factor :        0.10000000
>   add_offset :     0
>
> [snip]
>
> [5] The user must unpack the variable of type short.  You could use
>
> https://www.ncl.ucar.edu/Document/Functions/Contributed/short2flt.shtml
>
> ======
> Really, I would not use addfiles for your application. I would loop over
> each file and overlay each swath file/swath individually. Then, advance the
> frame.
>
> See attached
> ======
>
> Good Luck
>
> On Sat, Dec 30, 2017 at 2:54 AM, Krishnakumar AP via ncl-talk <
> ncl-talk at ucar.edu> wrote:
>
>> Dear NCL Community,
>>
>> This is a re-post of my previous question, regarding distortions appear
>> when merging multiple modis hdf files into a single plot.
>> I am using NCL 6.4.0 and data used from Modis Cloud Products(06_L2)
>>
>> I have uploaded few of data to the ftp (ftp.cgd.ucar.edu), file names
>> are
>> xMOD06_L2.A2011349.0550.006.2015056134430.hdf
>> xMOD06_L2.A2011349.0730.006.2015056133545.hdf
>> xMOD06_L2.A2011349.0735.006.2015056132747.hdf
>>
>> NCL code,
>>
>> begin
>>>
>>> ;::::::::::::::::::::::::::::::::::
>>> fils=systemfunc("ls ./xMOD06_L2*.hdf")
>>> f=addfiles(fils,"r")
>>> ;::::::::::::::::::::::::::::::::::
>>>
>>> ListSetType(f,"cat")
>>> cl = f[:]->Cloud_Top_Pressure
>>>
>>> ;::::::::::::::::::::::::::::::::::
>>>
>>> printVarSummary(cl)
>>>
>>> cl at lat2d = f[:]->Latitude
>>> cl at lon2d = f[:]->Longitude
>>>
>>> wks=gsn_open_wks("png","1_modis_ctp_349")
>>> ;:::::::::::::::::::::::::::::::::::::::::::
>>>
>>> res=True                                                 ; plot mods
>>> desired
>>> res at gsnMaximize        =True                  ; make plot large
>>> res at cnLinesOn           =False                  ; turn off contour lines
>>> ;res at cnLineLabelsOn   =True                   ; turn off contour line
>>> labels
>>> res at gsnSpreadColors   =True                  ; use the entire color
>>> spectrum
>>> res at cnFillOn               =True                   ; enable contour fill
>>> res at gsnMaximize        =True                   ; make plot large
>>> res at mpGeophysicalLineThicknessF= 2.   ; double the thickness of
>>> geophysical boundaries
>>> res at cnMissingValFillPattern = 0
>>> res at cnFillMode = "RasterFill"
>>>
>>> ;::::::ZOOM:::::::::::;
>>> res at mpMinLatF = 20
>>> res at mpMaxLatF = 32
>>> res at mpMinLonF = 68
>>> res at mpMaxLonF = 95
>>>
>>> ;:::::::::::::Title&Plotting::::::::::::::::
>>>   res at tiMainString="Cloud Top Pressure"            ; create title
>>>   plot=gsn_csm_contour_map_ce(wks,cl,res)       ; plot on world map
>>> first
>>>   delete(res at tiMainString)                                  ; delete
>>> title for subsequent plots
>>>
>>> ;:::::::::::::Clean up resources used:::::::::::::::::::::
>>>   delete(plot)
>>>   delete(wks)
>>>   delete(res)
>>> end
>>>
>>
>> Individually each file plotted properly, but when it get merged,
>> distortions or clippings occurred.
>>
>> As per Rick Brownrigg's suggestion, res at cnFillMode = "RasterFill" added,
>> but could not get any better. Thanks for your kind response.
>> I have attached the ncl_filedump of three example files, PrintVarSummary
>> and the output.
>>
>> Please help me on this. Thanks in advance.
>>
>>
>>
>> --
>>
>> Best regards
>> Krishnakumar.AP
>> Research Fellow
>> Banaras Hindu University, India.
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>


-- 

Best regards
Krishnakumar.AP
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180106/e677cf41/attachment.html>


More information about the ncl-talk mailing list