asascience-open / thredds_crawler_matlab

A simple Matlab crawler/parser for THREDDS catalogs
MIT License
0 stars 1 forks source link

retrieve file names from thredds directory #3

Open thesser1 opened 9 years ago

thesser1 commented 9 years ago

@Bobfrat is there a way to retrieve the name of all the datasets inside the catalog provided to thredds crawler in a method similar to the python version of the crawler. I need to know what is in the directory so I can open the file I am interested in.

Bobfrat commented 9 years ago

Where there's a will there's a way! I'll check it out. So you want this functionality:

print c.datasets
[
  <LeafDataset id: MODIS-Agg, name: MODIS-Complete Aggregation, services: ['OPENDAP', 'ISO']>,
  <LeafDataset id: MODIS-2009-Agg, name: MODIS-2009 Aggregation, services: ['OPENDAP', 'ISO']>,
  <LeafDataset id: MODIS-2010-Agg, name: MODIS-2010 Aggregation, services: ['OPENDAP', 'ISO']>,
  <LeafDataset id: MODIS-2011-Agg, name: MODIS-2011 Aggregation, services: ['OPENDAP', 'ISO']>,
  <LeafDataset id: MODIS-2012-Agg, name: MODIS-2012 Aggregation, services: ['OPENDAP', 'ISO']>,
  <LeafDataset id: MODIS-2013-Agg, name: MODIS-2013 Aggregation, services: ['OPENDAP', 'ISO']>,
  <LeafDataset id: MODIS-One-Agg, name: 1-Day-Aggregation, services: ['OPENDAP', 'ISO']>,
  <LeafDataset id: MODIS-Three-Agg, name: 3-Day-Aggregation, services: ['OPENDAP', 'ISO']>,
  <LeafDataset id: MODIS-Seven-Agg, name: 7-Day-Aggregation, services: ['OPENDAP', 'ISO']>
]
thesser1 commented 9 years ago

yup, it is just a nice package to use when I am searching a thredds server for a certain file. For instance on the CDIP historical site you can have many deployments and if I want to find out which deployment has the data I want I need to be able to look through each of the files to find the right time frame. Then I can get the relevant information from that time frame. Not sure if that made sense, but basically I am agreeing with your last comment in a lot of words.

Bobfrat commented 9 years ago

@thesser1 I just made an update here #4

I already identified a flaw with the way I did it because I used a global variable to update the output structure. If you use it more than once the results are going to keep appending to that structure so I suggest wrapping this function in a script and calling clear global datasets afterwards.