Mercurial > repos > ecology > xarray_metadata_info
changeset 0:965fcab0cd9f draft
"planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/data_manipulation/xarray/ commit 812c1c92d6596722642515ba99c5efab113b6a68"
author | ecology |
---|---|
date | Mon, 18 May 2020 08:30:10 -0400 |
parents | |
children | 7edbe5ae8b72 |
files | test-data/Metadata_infos_from_dataset-ibi-reanalysis-bio-005-003-monthly-regulargrid_1510914389133.nc.Variables.tab test-data/dataset-ibi-reanalysis-bio-005-003-monthly-regulargrid_1510914389133.nc test-data/info_file.txt xarray_metadata_info.xml |
diffstat | 4 files changed, 164 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/Metadata_infos_from_dataset-ibi-reanalysis-bio-005-003-monthly-regulargrid_1510914389133.nc.Variables.tab Mon May 18 08:30:10 2020 -0400 @@ -0,0 +1,8 @@ +VariableName NumberOfDimensions Dim0Name Dim0Size Dim1Name Dim1Size Dim2Name Dim2Size Dim3Name Dim3Size +phy 4 time 145 depth 1 latitude 97 longitude 103 +chl 4 time 145 depth 1 latitude 97 longitude 103 +nh4 4 time 145 depth 1 latitude 97 longitude 103 +time 1 time 145 +longitude 1 longitude 103 +latitude 1 latitude 97 +depth 1 depth 1
Binary file test-data/dataset-ibi-reanalysis-bio-005-003-monthly-regulargrid_1510914389133.nc has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/info_file.txt Mon May 18 08:30:10 2020 -0400 @@ -0,0 +1,74 @@ +xarray.Dataset { +dimensions: + depth = 1 ; + latitude = 97 ; + longitude = 103 ; + time = 145 ; + +variables: + float32 phy(time, depth, latitude, longitude) ; + phy:_CoordinateAxes = time depth latitude longitude ; + phy:long_name = Mole Concentration of Phytoplankton expressed as carbon in sea water ; + phy:standard_name = mole_concentration_of_phytoplankton_expressed_as_carbon_in_sea_water ; + phy:units = mmol.m-3 ; + phy:unit_long = mole_concentration_of_phytoplankton_expressed_as_carbon_in_sea_water ; + datetime64[ns] time(time) ; + time:standard_name = time ; + time:long_name = time ; + time:_CoordinateAxisType = Time ; + time:axis = T ; + float32 chl(time, depth, latitude, longitude) ; + chl:_CoordinateAxes = time depth latitude longitude ; + chl:long_name = Mass Concentration of Chlorophyll in Sea Water ; + chl:standard_name = mass_concentration_of_chlorophyll_in_sea_water ; + chl:units = mg.m-3 ; + chl:unit_long = milligram of chlorophyll per cubic meter ; + float32 nh4(time, depth, latitude, longitude) ; + nh4:_CoordinateAxes = time depth latitude longitude ; + nh4:long_name = Mole Concentration of Ammonium in Sea Water ; + nh4:standard_name = mole_concentration_of_ammonium_in_sea_water ; + nh4:units = mmol.m-3 ; + nh4:unit_long = millimoles of Ammonium per cubic meter ; + float32 longitude(longitude) ; + longitude:long_name = Longitude ; + longitude:units = degrees_east ; + longitude:standard_name = longitude ; + longitude:axis = X ; + longitude:unit_long = Degrees East ; + longitude:step = 0.08333f ; + longitude:_CoordinateAxisType = Lon ; + float32 latitude(latitude) ; + latitude:long_name = Latitude ; + latitude:units = degrees_north ; + latitude:standard_name = latitude ; + latitude:axis = Y ; + latitude:unit_long = Degrees North ; + latitude:step = 0.08333f ; + latitude:_CoordinateAxisType = Lat ; + float32 depth(depth) ; + depth:long_name = Depth ; + depth:units = m ; + depth:axis = Z ; + depth:positive = down ; + depth:unit_long = Meters ; + depth:standard_name = depth ; + depth:_CoordinateAxisType = Height ; + depth:_CoordinateZisPositive = down ; + +// global attributes: + :title = CMEMS IBI REANALYSIS: MONTHLY BIOGEOCHEMICAL PRODUCTS (REGULAR GRID) ; + :institution = Puertos del Estado (PdE) - Mercator-Ocean (MO) ; + :references = http://marine.copernicus.eu ; + :source = CMEMS IBI-MFC ; + :Conventions = CF-1.0 ; + :history = Data extracted from dataset http://puertos2.cesga.es:8080/thredds/dodsC/dataset-ibi-reanalysis-bio-005-003-monthly-regulargrid ; + :time_min = 7272.0 ; + :time_max = 112464.0 ; + :julian_day_unit = Hours since 2002-02-15 ; + :z_min = 0.5057600140571594 ; + :z_max = 0.5057600140571594 ; + :latitude_min = 43.0 ; + :latitude_max = 51.0 ; + :longitude_min = -6.000000476837158 ; + :longitude_max = 2.4999990463256836 ; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xarray_metadata_info.xml Mon May 18 08:30:10 2020 -0400 @@ -0,0 +1,82 @@ +<tool id="xarray_metadata_info" name="NetCDF xarray Metadata Info" version="0.15.1"> + <description>summarize content of a Netcdf file</description> + <requirements> + <requirement type="package" version="3">python</requirement> + <requirement type="package" version="1.5.3">netcdf4</requirement> + <requirement type="package" version="0.15.1">xarray</requirement> + <requirement type="package" version="0.7.0">geopandas</requirement> + <requirement type="package" version="1.7.0">shapely</requirement> + </requirements> + <command detect_errors="exit_code"><![CDATA[ + python3 '$__tool_directory__/xarray_tool.py' '$input' --info '$info' --summary '$output' + ]]></command> + <inputs> + <param type="data" name="input" label="Netcdf file" format="netcdf,h5" help="Netcdf file you need information about."/> + </inputs> + <outputs> + <data name="output" format="tabular" label="Metadata infos from ${input.name}" from_work_dir="variables.tabular"/> + <data name="info" label="info file" format="txt"/> + </outputs> + <tests> + <test> + <param name="input" value="dataset-ibi-reanalysis-bio-005-003-monthly-regulargrid_1510914389133.nc"/> + <param name="output" value="Metadata_infos_from_dataset-ibi-reanalysis-bio-005-003-monthly-regulargrid_1510914389133.nc.Variables.tab"/> + <output name="info" value="info_file.txt"> + <assert_contents> + <has_text_matching expression="depth\s+=\s+1"/> + <has_text_matching expression="latitude\s+=\s+97"/> + <has_text_matching expression="longitude\s+=\s+103"/> + <has_text_matching expression="time\s+=\s+145"/> + </assert_contents> + </output> + <output name="output" ftype="tabular" file="Metadata_infos_from_dataset-ibi-reanalysis-bio-005-003-monthly-regulargrid_1510914389133.nc.Variables.tab"> + <assert_contents> + <has_text_matching expression="VariableName\tNumberOfDimensions\tDim0Name\tDim0Size\tDim1Name\tDim1Size\tDim2Name\tDim2Size\tDim3Name\tDim3Size"/> + <has_text_matching expression="phy\t4\ttime\t145\tdepth\t1\tlatitude\t97\tlongitude\t103"/> + <has_text_matching expression="chl\t4\ttime\t145\tdepth\t1\tlatitude\t97\tlongitude\t103"/> + <has_text_matching expression="nh4\t4\ttime\t145\tdepth\t1\tlatitude\t97\tlongitude\t103"/> + <has_text_matching expression="time\t1\ttime\t145"/> + <has_text_matching expression="longitude\t1\tlongitude\t103"/> + <has_text_matching expression="latitude\t1\tlatitude\t97"/> + <has_text_matching expression="depth\t1\tdepth\t1"/> + </assert_contents> + </output> + </test> + </tests> + <help><![CDATA[ +**What it does** + +First the tool will give general information about the input in a 'info file' output. (command $ncdump -h inputfile) + +Then, a general tabular 'variables' summarize dimensions details inside each available variable. + + +The summary tabular file has the general structure : + + + Variable1 Var1_Number_of_Dim Dim1 Dim1_size ... DimN DimN_size + + VariableX VarX_Number_of_Dim DimX1 DimX1_size ... DimXN DimXN_size + + ... + + +**Input** + +A netcdf file (xxx.nc). + +**Outputs** + +An Information file. + +A summary tabular file. + + +-------------------------------- + +The Netcdf Info tool use the netcdf functions : https://www.unidata.ucar.edu/software/netcdf/docs/index.html + +Run this tool before considering using Netcdf Read. + ]]></help> + +</tool>