Using Javascript to make parallel server requests THREDDS OPeNDAP

流过昼夜 提交于 2019-12-12 03:15:15

问题


For the following THREDDS OPeNDAP server:

http://data.nodc.noaa.gov/thredds/catalog/ghrsst/L2P/MODIS_T/JPL/2015/294/catalog.html

I would like to note four Attributes of every file in there. The attributes are: northernmost lattitude; easternmost lattitude; westernmost lattitude; southernmost lattitude. These can be found under the Global attributes under:

http://data.nodc.noaa.gov/thredds/dodsC/ghrsst/L2P/MODIS_T/JPL/2015/294/20151021-MODIS_T-JPL-L2P-T2015294235500.L2_LAC_GHRSST_N-v01.nc.bz2.html

At first I tried this with MATLAB. Problem is: all the netcdf files on the server are compiled to .bz2 files. This makes calling for the Global attributes take around 15 seconds (the server is extracting the file). I would like javascript to run these server requests parallel to save me time. In total I need 90,000 files.

Is there a way to code this using javascript?


回答1:


You can use the THREDDS DAS service. DAS

Change the OPenDAP link you have above replacing the .html extension with .das This is a small text file with metadata about the file which could be easily parsed with javascript and includes a section with the global attributes:

 NC_GLOBAL {
    . . .
    Float32 northernmost_latitude 89.9942;
    Float32 southernmost_latitude 66.9853;
    Float32 easternmost_longitude -121.445;
    Float32 westernmost_longitude 76.7485;
    . . .
  }

This metadata is cached by THREDDS and the above DAS link responds instantly.

Edit:

Re: the correct comments below, (cache exists only after the first request) one alternative might be to use the source data at the NASA JPL OPeNDAP Server (Hyrax): http://podaac-opendap.jpl.nasa.gov/opendap/allData/ghrsst/data/L2P/MODIS_T/JPL/

My browser only tests (i.e. subjective) seem to show that a random DAS responses are quicker, than 15 seconds.

http://podaac-opendap.jpl.nasa.gov/opendap/allData/ghrsst/data/L2P/MODIS_T/JPL/2015/294/20151021-MODIS_T-JPL-L2P-T2015294084500.L2_LAC_GHRSST_N-v01.nc.bz2.das



来源:https://stackoverflow.com/questions/33958735/using-javascript-to-make-parallel-server-requests-thredds-opendap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!