; Copyright (C) 2009-2016 The HDF Group ; All rights reserved. ; ; This example code illustrates how to access the remote MLS file via OPeNDAP ; and plots vertical profile (time:X-axis, pressure:Y-axis). ; ; If you have any questions, suggestions, comments on this example, ; please use the HDF-EOS Forum (http://hdfeos.org/forums). ; ; If you would like to see an example of any other NASA HDF/HDF-EOS ; data product that is not listed in the HDF-EOS Comprehensive Examples page ; (http://hdfeos.org/zoo), feel free to contact us at eoshelp@hdfgroup.org ; or post it at the HDF-EOS Forum (http://hdfeos.org/forums). ; ; This demo is based on the following example: ; http://www.ncl.ucar.edu/Applications/Scripts/hdf5eos_3.ncl ; ; Usage: ; ; %ncl mls.ncl ; ; Tested on: NLC 6.3.0 ; Last updated: 2016-12-14 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" begin ; The official NASA OPeNDAP server url = "http://acdisc.gesdisc.eosdis.nasa.gov:80/opendap/HDF-EOS5/Aura_MLS_Level2/ML2BRO.004/2016/" ; Use the following URL for The HDF Group demo server. ; url = "https://eosdap.hdfgroup.org:8080/opendap/data/NASAFILES/hdf5/" ; Use the following URL for The HDF Group internal demo server. ; url = "http://giraffe.ad.hdfgroup.org:8080/opendap/data/NASAFILES/hdf5/" fName = "MLS-Aura_L2GP-BrO_v04-23-c03_2016d302.he5" ; Please register for Earthdata Login and create cookie file first. ; ; For more information about user registration and cookie, please visit ; ; https://disc.gsfc.nasa.gov/registration/registration-for-data-access ; ; Issue the following either wget or curl command to generate the cookie. ; ; $curl -n -c ~/.urs_cookies -b ~/.urs_cookies -L -g --url http://acdisc.gesdisc.eosdis.nasa.gov:80/opendap/HDF-EOS5/Aura_MLS_Level2/ML2BRO.004/2016/MLS-Aura_L2GP-BrO_v04-23-c03_2016d302.he5.dods\?BrO_L2gpValue\[0:1:0\]\[0:1:0\] -o test.dods ; ; $wget --load-cookies ~/.urs_cookies --save-cookies ~/.urs_cookies --auth-no-challenge=on --keep-session-cookies http://acdisc.gesdisc.eosdis.nasa.gov:80/opendap/HDF-EOS5/Aura_MLS_Level2/ML2BRO.004/2016/MLS-Aura_L2GP-BrO_v04-23-c03_2016d302.he5.dods\?BrO_L2gpValue\[0:1:0\]\[0:1:0\] -O test.dods ; ; Once cookie is created, you don't ahve to create it again. if ( isfilepresent(url+fName) ) then f = addfile ( url + fName , "r") end if ; Check if the remote file is opened successfully ; and what variables are available. print(f) T = f->BrO_L2gpValue lat = f->BrO_Latitude lon = f->BrO_Longitude lev = f->BrO_Pressure time = f->BrO_Time ; Re-scale the data values. T = T*1e7 T@units = T@units + "*1e-7" ; MLS product uses TAI-93. time@units = "seconds since 1993-1-1 00:00:0.0" lev@long_name = lev@title ; cd_calendar() is supported since NCL 6.0.0. ; Use ut_calendar() for older version. utc_date = cd_calendar(time(0), 0) year = tointeger(utc_date(:,0)) month = tointeger(utc_date(:,1)) day = tointeger(utc_date(:,2)) hour = tointeger(utc_date(:,3)) minute = tointeger(utc_date(:,4)) second = utc_date(:,5) date_str = sprinti("%0.4i", year) + "-" + sprinti("%0.2i", month) + "-" + \ sprinti("%0.2i ", day) + sprinti("%0.2i", hour) + ":" + \ sprinti("%0.2i", minute) + ":" + sprintf("%0.2f", second) ; The rest of the code is almost identical to hdf5eos_3.ncl printMinMax(T, True) print("==============") ; Create an "elapsed time" variable. telapse = dble2flt((time - time(0))/60) telapse!0 = "Latitude" telapse@long_name = "Elapsed Time" telapse@units = "minutes since " + date_str printVarSummary(telapse) ; Plot. pltType = "pdf" pltName = fName+".ncl" wks = gsn_open_wks (pltType,pltName) ; open workstation gsn_define_colormap(wks,"amwg") ; choose colormap dumb = NhlNewColor(wks,0.7,0.7,0.7) ; add gray to colormap res = True res@gsnMaximize = True ; make ps/eps/pdf res@gsnSpreadColors = True res@gsnSpreadColorEnd = -2 ; do not use gray for contours res@gsnPaperOrientation = "portrait" ; force portrait res@tiMainString = fName res@cnFillOn = True res@cnLinesOn = False res@cnLineLabelsOn = False res@cnFillMode = "RasterFill" ; faster res@cnRasterSmoothingOn = True res@lbLabelAutoStride = True res@lbOrientation = "Vertical" res@trYReverse = True; ; Change these values based on min/max values of L2gpValue dataset. res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels res@cnMinLevelValF = -6. ; set min contour level res@cnMaxLevelValF = 6. ; set max contour level res@cnLevelSpacingF = 1. ; set contour spacing T&BrO_Pressure = lev ; assign "pressure" coordinates T&BrO_Latitude = telapse ; assign temporal coordinates res@gsnYAxisIrregular2Linear = True res@tmYLFormat = "f" ; force minimal precision res@tiYAxisString = lev@long_name + " (" + lev@units + ")" res@tiXAxisString = telapse@long_name + " (" + telapse@units + ")" res@gsnLeftString = T@title plot = gsn_csm_contour (wks,T(BrO_Pressure|:,BrO_Latitude|:) , res) ; Create trajectory plot. mpres = True ; Plot options desired. mpres@gsnFrame = False ; Don't advance the frame mpres@gsnMaximize = True mpres@mpLandFillColor = "gray70" ; color of land mpres@gsnPaperOrientation= "portrait" ; force portrait plot = gsn_csm_map_ce(wks,mpres) ; Draw map gsres = True ; "Graphic Style" resources gsres@gsMarkerSizeF = 10.0 ; Marker size gsres@gsMarkerThicknessF = 1.0 ; Marker thickness gsres@gsMarkerColor = "Blue" ; Marker color gsres@gsMarkerIndex = 1 ; Marker style mpres@tiMainString = fName gsn_polymarker(wks,plot,lon,lat,gsres) ; plot trajectory frame(wks) end