Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong _FillValue in exported netcdf #123

Open
mortenwh opened this issue Mar 3, 2015 · 5 comments
Open

Wrong _FillValue in exported netcdf #123

mortenwh opened this issue Mar 3, 2015 · 5 comments
Assignees
Labels
Milestone

Comments

@mortenwh
Copy link
Contributor

mortenwh commented Mar 3, 2015

When I export a Radarsat-2 image to netcdf, the _FillValue metadata item is set to 9.96921e+36 whereas the actual invalid data points are float(-10000). This causes the __getitem__ function in Nansat to fail. I have created a quick hack to set all values equal to float(-10000) in the np.array to np.nan when _FillValue is 9.96921e+36 but this should be corrected such that the _FillValue provided in the metadata is the same as the actual invalid data. See b7fba1f.

This problem seems to be solved in the export2thredds function, and probably the same fix should apply also in the export-function. If so, please make sure that code is not duplicated but that export and export2thredds use a common function.

I have created three tests for checking:

  • nansat.tests.test_export_netcdf (in the develop branch) which tests test_file_gcps by setting some band values to nan, then exports to a netcdf. This seems to work.
  • mapper_tests.test_mappers.TestRadarsat.test_export2thredds (in the master branch) which does not yet work because I didn't add all the parameters (see the code)
  • mapper_tests.test_mappers.TestRadarsat.test_export (in the master branch) which tests export of a radarsat-2 file

So, the tasks in this issue are to

  1. correct the export function so the metadata _FillValue item equals the actual values of invalid data
  2. remove the "hack" in nansat.Nansat.__getitem__
@mortenwh
Copy link
Contributor Author

mortenwh commented Mar 3, 2015

Btw - I also removed the try-except lines in __getitem__ - if such value replacements fail it should cause errors, otherwise we'll get difficulties in debugging when problems arise... Please be very careful with try-except.

mortenwh added a commit that referenced this issue Mar 3, 2015
…th try-except which was hiding some actual problems - please don't use try-except like that, it is better to raise a specific error which can be handled in the calling code
@asumak
Copy link
Contributor

asumak commented Mar 4, 2015

orig.export2thredds(ncfile, bands = {'incidence_angle': {}}) in TestRadarsat.test_export2thredds() does not work because dataset with GCPs cannot export for Thredds.
The problem should be fixed in export().

@mortenwh
Copy link
Contributor Author

mortenwh commented Mar 4, 2015

Don't worry about that now - we can reproject the image to make it work
later. It should be tested in any case but first the export function should
be improved
4. mars 2015 15:58 skrev "Asuka Yamakawa" [email protected]:

orig.export2thredds(ncfile, bands = {'incidence_angle': {}}) in
TestRadarsat.test_export2thredds() does not work because dataset with GCPs
cannot export for Thredds.
The problem should be fixed in export().


Reply to this email directly or view it on GitHub
#123 (comment).

@asumak
Copy link
Contributor

asumak commented Mar 4, 2015

It is related to issue42.
I will test how it works if pixelfunction returns NaN. (a6286a9)

@mortenwh
Copy link
Contributor Author

mortenwh commented Mar 4, 2015

Great - that will probably work and both issues should be solved :) perfect

It is related to issue42.
I will test how it works if pixelfunction returns NaN. (a6286a9
a6286a9
)


Reply to this email directly or view it on GitHub
#123 (comment).

asumak added a commit that referenced this issue Mar 5, 2015
@mortenwh mortenwh assigned mortenwh and unassigned asumak Mar 13, 2015
@akorosov akorosov assigned aleksandervines and unassigned mortenwh Sep 8, 2015
@akorosov akorosov added this to the Nansat 0.7 milestone Sep 8, 2015
@akorosov akorosov modified the milestones: Nansat 0.7, Nansat 1.0 Dec 14, 2017
@aleksandervines aleksandervines added bug and removed bug labels Jan 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants