Reading-eScience-Centre / pycovjson

Create CovJSON files from common scientific data formats
BSD 3-Clause "New" or "Revised" License
11 stars 7 forks source link

pycovjson-viewer trims values resulting in inability to view #32

Closed lewismc closed 6 years ago

lewismc commented 7 years ago

Hi Folks, Recently I noticed that the pycovjson-viewer tool is providing less insight into netCDF files. An example is as follows

lmcgibbn@LMC-056430 /usr/local/pycovjson(master) $ pycovjson-viewer -v ~/Desktop/20160304-DMI-L4UHfnd-NSEABALTIC-v01-fv01-DMI_OI.nc
Error in sitecustomize; set PYTHONVERBOSE for traceback:
KeyError: 'PYTHONPATH'
<xarray.Dataset>
Dimensions:         (lat: 600, lon: 1334, time: 1)
Coordinates:
  * lon             (lon) float32 -9.99 -9.96 -9.93 -9.9 -9.87 -9.84 -9.81 ...
  * lat             (lat) float32 48.01 48.04 48.07 48.1 48.13 48.16 48.19 ...
  * time            (time) datetime64[ns] 2016-03-04
Data variables:
    analysed_sst    (time, lat, lon) float64 284.8 284.8 284.8 284.8 284.7 ...
    analysis_error  (time, lat, lon) float64 0.6 0.58 0.58 0.58 0.58 0.58 ...
    mask            (time, lat, lon) float64 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 ...
Attributes:
    Conventions:            CF-1.0
    title:                  DMI Sea Surface Temperature analysis
    GDS_version_id:         v1.0-rev1.7
    netcdf_version_id:      netcdf-3.6.1-beta3 of Jan  9 2006 03:17:05
    DSD_entry_id:           DMI-L4UHfnd-NSEABALTIC-DMI_OI
    institution:            Center for Ocean and Ice, Danish Meteorological I...
    references:             http://ocean.dmi.dk
    contact:                jlh@dmi.dk
    creation_date:          2016-03-04T07:19:43 UTC
    product_version:        Version 1.0
    history:                Version 1.0
    spatial_resolution:       0.03 degrees
    start_date:             2016-03-04
    start_time:             00:00:00
    stop_date:              2016-03-05
    stop_time:              00:00:00
    source_data:            Nighttime AMSRE,ATS_NR_2P,AVHRR18_G,AVHRR17_NAR,A...
    westernmost_longitude:  -9.99
    easternmost_longitude:  30.0
    southernmost_latitude:  48.01
    northernmost_latitude:  65.98
    file_quality_index:     0
    comment:                IN NO EVENT SHALL DMI OR ITS REPRESENTATIVES BE L...

As you can see some values are trimmed... which is not great for viewing purposes. Does anyone know where the logic behind this is? I would like to submit a PR which reverts back to printing the entire value for coordinates, variables and attributes. Thanks

RileyWilliams commented 7 years ago

@lewismc pycovjson-viewer uses the xarray open_dataset function and simply prints out the dataset object. The code for this is in cli/pycovjson-viewer.py and read_netcdf.py. It was originally intended mainly for testing but it should be fairly easy to adapt it so that it no longer trims the output. The Xarray Api Docs detail the different attributes of the dataset object, these could be printed individually and formatted as required