Hello, I use ncdf4 and ncdf4.helpers packages to get wind data from ncep/ncar reanalysis ncetcdf files. But data is in the form of (9.199998, 8.799998, 7.999998, 3.099998, -6.8000018, ?). I?m aware of precision and least_significant_digit attributes of ncdf4 object [1]. For uwnd data, precision = 2 and least_significant_digits = 1. My doubt is that should I round data to 2 decimal places or 1 decimal place after decimal point? Same issue is valid for some header info. Output of ncdf4 object: Output of ncdump on terminal: for instance, ncdump's scale factor is 0.01f but ncdf4 object?s scale_factor is 0.00999999977648258. You can notice same issue for actual_range and add_offset. Also a similar issue exist for the data. How can I truncate those extra unsignificant decimal places or round the numbers to significant decimal places? 1 - http://www.esrl.noaa.gov/psd/data/gridded/conventions/cdc_netcdf_standard.shtml <http://www.esrl.noaa.gov/psd/data/gridded/conventions/cdc_netcdf_standard.shtml>
Same as with any floating point numeric computation environment... you don't. There is always uncertainty in any floating point number... it is just larger in this data than you might be used to. Once you get to the stage where you want to output values, read up on ?round ?par (digits) and don't worry about the incidental display of extra digits prior to presentation (output). -- Sent from my phone. Please excuse my brevity. On July 7, 2016 12:50:54 AM PDT, Ismail SEZEN <sezenismail at gmail.com> wrote:>Hello, > >I use ncdf4 and ncdf4.helpers packages to get wind data from ncep/ncar >reanalysis ncetcdf files. But data is in the form of (9.199998, >8.799998, 7.999998, 3.099998, -6.8000018, ?). I?m aware of precision >and least_significant_digit attributes of ncdf4 object [1]. For uwnd >data, precision = 2 and least_significant_digits = 1. My doubt is that >should I round data to 2 decimal places or 1 decimal place after >decimal point? > >Same issue is valid for some header info. > >Output of ncdf4 object: > > >Output of ncdump on terminal: > > >for instance, ncdump's scale factor is 0.01f but ncdf4 object?s >scale_factor is 0.00999999977648258. You can notice same issue for >actual_range and add_offset. Also a similar issue exist for the data. >How can I truncate those extra unsignificant decimal places or round >the numbers to significant decimal places? > >1 - >http://www.esrl.noaa.gov/psd/data/gridded/conventions/cdc_netcdf_standard.shtml ><http://www.esrl.noaa.gov/psd/data/gridded/conventions/cdc_netcdf_standard.shtml> >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.
Correction: ?options (not par) -- Sent from my phone. Please excuse my brevity. On July 7, 2016 3:26:06 PM PDT, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:>Same as with any floating point numeric computation environment... you >don't. There is always uncertainty in any floating point number... it >is just larger in this data than you might be used to. > >Once you get to the stage where you want to output values, read up on > >?round >?par (digits) > >and don't worry about the incidental display of extra digits prior to >presentation (output). >-- >Sent from my phone. Please excuse my brevity. > >On July 7, 2016 12:50:54 AM PDT, Ismail SEZEN <sezenismail at gmail.com> >wrote: >>Hello, >> >>I use ncdf4 and ncdf4.helpers packages to get wind data from ncep/ncar >>reanalysis ncetcdf files. But data is in the form of (9.199998, >>8.799998, 7.999998, 3.099998, -6.8000018, ?). I?m aware of precision >>and least_significant_digit attributes of ncdf4 object [1]. For uwnd >>data, precision = 2 and least_significant_digits = 1. My doubt is that >>should I round data to 2 decimal places or 1 decimal place after >>decimal point? >> >>Same issue is valid for some header info. >> >>Output of ncdf4 object: >> >> >>Output of ncdump on terminal: >> >> >>for instance, ncdump's scale factor is 0.01f but ncdf4 object?s >>scale_factor is 0.00999999977648258. You can notice same issue for >>actual_range and add_offset. Also a similar issue exist for the data. >>How can I truncate those extra unsignificant decimal places or round >>the numbers to significant decimal places? >> >>1 - >>http://www.esrl.noaa.gov/psd/data/gridded/conventions/cdc_netcdf_standard.shtml >><http://www.esrl.noaa.gov/psd/data/gridded/conventions/cdc_netcdf_standard.shtml> >>______________________________________________ >>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >>https://stat.ethz.ch/mailman/listinfo/r-help >>PLEASE do read the posting guide >>http://www.R-project.org/posting-guide.html >>and provide commented, minimal, self-contained, reproducible code. > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.