[ncl-talk] OPeNDAP retrieval of MODIS as .nc?

Dennis Shea shea at ucar.edu
Wed Jul 10 08:03:22 MDT 2019


I have an Earthdata login.

[1] Download as HDF
[2]

*%> ncl_filedump
<https://www.ncl.ucar.edu/Document/Tools/ncl_filedump.shtml>*
MOD10A1.A2000070.h12v04.006.2016061222432.hdf | less

Variable: f
Type: file
filename:       MOD10A1.A2000070.h12v04.006.2016061222432
path:   MOD10A1.A2000070.h12v04.006.2016061222432.hdf
   file global attributes:
      *HDFEOSVersion : HDFEOS_V2.17*
      StructMetadata_0 : GROUP=*SwathStructure*
END_GROUP=SwathStructure
[SNIP]

[3] Obviously, this is a HDF-EOS file containing swath data. Attach the '
*.he2*' or, equivalently, "*.**hdfeos*"
The actual file name need not have the .he2 extension. It can be added on
the command line ['dynamically']

*%> ncl_filedump* MOD10A1.A2000070.h12v04.006.2016061222432.hdf*.he2* | less

The* he2* file extension results in NCL creating some 'value added'
variables

[4] NCL can process the file(s) directly so from an NCL perspective,  there
is no need to convert. However, if you want netCDF, then, as noted, you can
use

*%>* *ncl_convert2c*
<https://www.ncl.ucar.edu/Document/Tools/ncl_convert2nc.shtml>
MOD10A1.A2000070.h12v04.006.2016061222432.hdf*.he2*

or, for netCDF-4

*%>* *ncl_convert2c* *-nc4* MOD10A1.A2000070.h12v04.006.2016061222432.hdf
*.he2*

*[*4] Within an NCL script:

   file_name = "....hdf"
    f = *addfile*
<https://www.ncl.ucar.edu/Document/Functions/Built-in/addfile.shtml>(file_name
+".he2","r")       ; *addfiles *
<https://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml>also



On Tue, Jul 9, 2019 at 4:16 PM Dave Allured - NOAA Affiliate via ncl-talk <
ncl-talk at ucar.edu> wrote:

> Elizabeth,
>
> I get a similar error using ncdump, which is independent from NCL.  So
> this is not really an NCL question.
>
> If you want to continue to try Opendap, then please see this NSIDC help
> page for Opendap access.  You will probably need to provide your Earthdata
> account credentials using one of the mechanisms shown on that page.  If
> this does not work expediently, then I suggest that you contact NSIDC User
> Services through the e-mail link at the bottom of that page.
>
>     https://nsidc.org/api/opendap/
>
>
> On Tue, Jul 9, 2019 at 4:02 PM Burakowski, Elizabeth via ncl-talk <
> ncl-talk at ucar.edu> wrote:
>
>> Hi Rick,
>>
>> thanks for the ncl_convert2nc tip, will use it once I can get this
>> OPeNDAP running properly.  For what it's worth, I had an older ncl script
>> that worked fine with the following address for MOD10A1 v005:
>>
>> http://nsidc.org:80/opendap/MOST/MOD10A1.005/
>>
>> But that no longer works.
>>
>> I had created my account at https://search.earthdata.nasa.gov
>> <https://search.earthdata.nasa.gov/search>, if that helps.
>>
>> Here is the full error message:
>>
>> syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET
>> or SCAN_ERROR
>> context: <!DOCTYPE^ html><!--[if lt IE 7]><html class="no-js lt-ie9
>> lt-ie8 lt-ie7"> <![endif]--><!--[if IE 7]><html class="no-js lt-ie9
>> lt-ie8"> <![endif]--><!--[if IE 8]><html class="no-js lt-ie9">
>> <![endif]--><!--[if gt IE 8]><!--><html lang="en"
>> class="no-js"><!--<![endif]--> <head> <meta charset="utf-8"> <meta
>>
>
> <snip>
>
>
>> toUTCString()+';path=/;';setTimeout(f5_cspm.wait_perf_data,100);}}}}f5_cspm.go();}());</script>
>> ncopen: filename "
>> https://n5eil02u.ecs.nsidc.org/opendap/MOST/MOD10A1.006/2019.06.30/MOD10A1.A2019181.h12v04.006.2019183024309.hdf":
>> NetCDF: Malformed or inaccessible DAP DDS
>>
>>
>> *From:* Rick Brownrigg <brownrig at ucar.edu>
>> *Sent:* Tuesday, July 9, 2019 5:53 PM
>>
>> Hi Elizabeth,
>>
>> I unfortunately can not test this directly, as one must have an account
>> on that OpenDAP site. However, if you can download the HDF version, you
>> could use "ncl_convert2nc" to NetCDF.
>>
>> Otherwise, seeing all the error messages might yield some insights.
>>
>> Hope that helps...
>> Rick
>>
>>
>> On Tue, Jul 9, 2019 at 3:15 PM Burakowski, Elizabeth via ncl-talk <
>> ncl-talk at ucar.edu> wrote:
>>
>> Hello,
>>
>> I am writing an NCL script to pull a subset of MOD10A1 Daily Snow Cover
>> files for analysis. I'd like to pull the files as netCDF instead of hdf.
>>
>> The UI page seems to suggest I can request as .nc:
>>
>>
>> https://n5eil02u.ecs.nsidc.org/opendap/MOST/MOD10A1.006/2000.03.10/MOD10A1.A2000070.h12v04.006.2016061222432.hdf.html
>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__n5eil02u.ecs.nsidc.org_opendap_MOST_MOD10A1.006_2000.03.10_MOD10A1.A2000070.h12v04.006.2016061222432.hdf.html&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=JW2rHHzYnVYi6ZDBI-2JFMNSreDPLZO-wwOrczEnOlg&m=Mro58-h7ajrO1nUBMp5gNIPzvaLfG99-mvbM6anW2mE&s=Ahorg8HVDvw9p0wAfDWVHds6fBChcRfwQWHIqO_1rV4&e=>
>>
>> But it's not clear how I would do this in NCL.  For hdf, I tried to use:
>>
>> filename = "MOD10A1.A2019181.h12v04.006.2019183024309.hdf"
>> subdir = "2019.06.30"
>> url = "https://n5eil02u.ecs.nsidc.org/opendap/MOST/MOD10A1.006/
>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__n5eil02u.ecs.nsidc.org_opendap_MOST_MOD10A1.006_&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=JW2rHHzYnVYi6ZDBI-2JFMNSreDPLZO-wwOrczEnOlg&m=Mro58-h7ajrO1nUBMp5gNIPzvaLfG99-mvbM6anW2mE&s=RVUJnW6bUsZvHlJtDUaEZ-yfLZkVtiW2gfQGLbVui60&e=>
>> "
>> exists = isfilepresent(url+sudir+"/"+filename)
>>
>> However, I receive an error that starts with:
>>
>> "syntax error, unexpected WORD_WORD, expecting SCAN_ATTR or SCAN_DATASET
>> or SCAN_ERROR"
>>
>> and ends with:
>>
>> "ncopen: filename "
>> https://n5eil02u.ecs.nsidc.org/opendap/MOST/MOD10A1.006/2019.06.30/MOD10A1.A2019181.h12v04.006.2019183024309.hdf
>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__n5eil02u.ecs.nsidc.org_opendap_MOST_MOD10A1.006_2019.06.30_MOD10A1.A2019181.h12v04.006.2019183024309.hdf&d=DwMFaQ&c=c6MrceVCY5m5A_KAUkrdoA&r=JW2rHHzYnVYi6ZDBI-2JFMNSreDPLZO-wwOrczEnOlg&m=Mro58-h7ajrO1nUBMp5gNIPzvaLfG99-mvbM6anW2mE&s=HRC_y02lVRpB5bHAZ1AY5QzBOIg41Hn3bHQx11jaOGs&e=>":
>> NetCDF: Malformed or inaccessible DAP DDS"
>>
>> I suspect there is something wrong with the url, but this is the one
>> provided by nsidc.
>>
>> Any suggestions?
>>
>> Thank you,
>>
>> Liz.
>>
>> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190710/93a6eb5f/attachment.html>


More information about the ncl-talk mailing list