cedadev / nappy

NASA Ames Processing in PYthon (NAPPy) - a Python library for reading, writing and converting NASA Ames files.
BSD 3-Clause "New" or "Revised" License
9 stars 13 forks source link

Fix time bounds values so they are correct in HadUK-Grid test #40

Closed agstephens closed 2 years ago

agstephens commented 2 years ago
$ cat output_01_5.csv

34,2010
Met Office
Data held at British Atmospheric Data Centre (BADC), Rutherford Appleton Laboratory, UK.
HadUK-Grid_v1.0.3.0
Gridded surface climate observations data for the UK
1,1
1971 1 16,2021 9 13
1,0
2
2
0,1
bnds
time
1
1
-1e+20
time_bnds
0
0
14
==== Normal Comments follow ====
creation_date:   2021-07-12T19:39:41
frequency:   mon
references:   doi: 10.1002/joc.1161
short_name:   monthly_snowlying
version:   v20210712
Conventions:   CF-1.7
NCO:   netCDF Operators version 4.9.7 (Homepage = http://nco.sf.net, Code = http://github.com/nco/nco)
=== Additional Global Attributes defined in the source file ===
Monthly resolution gridded climate observations
History:  2021-09-13 09:21:23 - Converted to NASA Ames format using nappy-0.3.0.
    Tue Aug 10 16:50:24 2021: ncks -d projection_x_coordinate,,,10 -d projection_y_coordinate,,,10 -d time,,,12 --variable snowLying /badc/ukmo-hadobs/data/insitu/MOHC/HadOBS/HadUK-Grid/v1.0.3.0/1km/snowLying/mon/v20210712/snowLying_hadukgrid_uk_1km_mon_197101-197112.nc ./archive/badc/ukmo-hadobs/data/insitu/MOHC/HadOBS/HadUK-Grid/v1.0.3.0/1km/snowLying/mon/v20210712/snowLying_hadukgrid_uk_1km_mon_197101-197112.nc
==== Normal Comments end ====
=== Data Section begins on the next line ===
1.4993e+06
1.49895e+06,1.49967e+06

Are they right? Need to check.

agstephens commented 2 years ago

Need to also check the time units and independent variable.

agstephens commented 2 years ago

Another fix applied to include time units in the string of the variable name.

But, hours are such a vast unit that precision is being lost in the test data:

(roocs) [root@localhost nappy]# ncdump -v time_bnds  /root/.mini-ceda-archive/main/archive/badc/ukmo-hadobs/data/insitu/MOHC/HadOBS/HadUK-Grid/v1.0.3.0/1km/snowLying/mon/v20210712/snowLying_hadukgrid_uk_1km_mon_197101-197112.nc | grep 149
  1498953, 1499673 ;
(roocs) [root@localhost nappy]# grep 49 output_01_5.csv
1.4993e+06
1.49895e+06,1.49967e+06

How to resolve?

agstephens commented 2 years ago

All fixed by changing default formatter to: %.10g so it only goes to exponent form if the overall length exceeds 10 chars (instead of 8).