Hyrax service providers may want to augment or correct issues found in the data products on the server-side. For example, one may want to correct no-CF compliant attribute names so that CF visualization tools can display the variable correctly. Hyrax's NcML module can be used to fulfill this purpose. The NcML module can also be used to aggregate the same variable accross different files. For the comprehensive tutorial information on how NcML can help correct or aggregate NASA HDF files, please check our NcML example page here. We want to use this page to share experience on using NcML to generate reasonable plots for special NASA HDF5 products in Panoply. The page may be updated frequently as we find more examples that can help NASA Hyrax service providers to use NcML to correct or aggregate the HDF5 files.
We use a LANCE AMSR-2 level 3 daily snow HDF-EOS5 file as an example. This file is a grid file that uses Lambert Azimuthal Equal Area(LAMAZ) projection. The projection is also called EASE-Grid. For detailed information, check the user’s guide of this product here .
For an HDF-EOS5 grid, one just needs to store the projection information for users to retrieve the latitude and longitude values. No separate latitude and longitude variables are needed. However, general applications may need to know the latitude and longitude values at each grid point. So the HDF5 handler retrieves the latitude and longitude values and saves them as separate DAP variables. Moreover, the HDF5 handler also follows the CF conventions to map the projection information in an HDF-EOS5 grid to DAP. For the detailed information on how HDF-EOS stores the projection information, please check HDF-EOS documents. For the corresponding information in CF, please check the grid mapping section in the CF 1.7.
Currently there are two ways to present the geo-location information in the DAP output. One way is to use array variables to store the latitude and longitude values. Another way is to save the geo-location information via CF grid mapping conventions. The HDF5 handler translates the geo-location information in both ways based on the customer's requests. The engineering to translate the information is not trivial. So naturally the user or the service provider may wonder whether the HDF5 handler correctly translates the original grid information. One can gain much more confidence if we can verify the two geo-location output is equivalent. In fact, one can use a visualization tool such as Panoply to carry out the job since Panoply can use either geo-location DAP output to generate a geo-referenced plot. However,Panoply doesn’t tell which geo-location information in the DAP output it uses. Now we can use the NcML module to force Panoply to only use one piece of geo-location information from DAP output. With this way, the geo-location information used by panoply to generate a plot is transparent to users and we can be sure what we are comparing.
Figure 1 shows a NcML file to remove the grid_mapping attribute of variable Northern_Hemisphere_SWE_NorthernDaily and Southern_Hemisphere_SWE_SouthernDaily. We can then use Panoply to open the URL that contains the NcML file. The plot generated by Panoply is forced to use the latitude and longitude variables generated by the HDF5 handler. One can verify the successful removal of the grid_mapping attributes by checking the AMSR_E DAP attribute output Remove_grid_mapping_das . One can find that the grid_mapping attribute is removed from variable Northern_Hemisphere_SWE_NorthernDaily and Southern_Hemisphere_SWE_SouthernDaily.
Figure 2 shows a NcML file that removes latitude and longitude fields associated with variable Northern_Hemisphere_SWE_NorthernDaily and Southern_Hemisphere_SWE_SouthernDaily . Again we can open this NcML file via Panoply. Panoply is forced to use the grid_mapping information provided by the HDF5 handler to generate the geo-referenced plot. One can verify the successful removal of the latitude and longitude fields by checking the AMSR_E DAP DDS output Remove_latlon_dds . One can find that the corresponding latitude and longitude variables such as Northern_Hemisphere_lon and Southern_Hemisphere_lat are not present in the DAP output.
One can use Panoply to open the NcML file that removes the grid mapping attribute. Choose the variable Northern_Hemisphere_SWE_NorthernDaily and generate a geo-referenced plot. In the same way, one can also open the NcML file that removes the latitude and longitude variables. Choose the variable Northern_Hemisphere_SWE_NorthernDaily and generates another geo-referenced plot. You can find these two plots the same. The plot should be like Northern_Hemisphere_SWE_NorthDaily_plot.
When we carefully examine the generated plot Northern_Hemisphere_SWE_NorthDaily_plot, we find the plot is mostly filled with the dark red, which is close to the maximum value. This may not be right. When you check the attribute values displayed by the Panoply, you find the _FillValue is set to -1B for variable Northern_Hemisphere_SWE_NorthernDaily. When checking the DAP DAS output from a web browser Remove_grid_mapping_das , the _FillValue of variable Northern_Hemisphere_SWE_NorthernDaily is 255. So panoply, in fact, the netCDF java underneath, doesn't present the _FillValue correctly because Java doesn't support unsigned datatype. However, we can use NcML to correct the _FillValue to be 255. The NcML file is as follows:
After correcting the fillvalue, check the plot Northern_Hemisphere_SWE_NorthDaily_correct_fillvalue_plot again, the area with the filled value is not plotted. But we still see the plot is filled with red color, which needs more examination.
Now, we have to resort to the product user's guide to see if there is key information about the data values that we don't know. This AMSR2 Daily L3 Global Snow Water Equivalent EASE-Grids User’s guide can be found under AMSR_2_Snow_water_user_guide or here. From the table 4 and table 5 of the document, we find the valid value of Snow Water Equivalence(SWE) is between 0 and 240. So we can create a NcML file to apply the CF valid_min and valid_max attributes on the SWE variables. This will force Panoply to only plot the area with data values between 0 and 240. The NcML file is as follows:
The final plot(Northern_Hemisphere_SWE_NorthDaily_with_valid_range.plot) can be found here. The snow water equivalence is clearly shown.