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

to_csv add lat and lon if None is selected #3

Closed
pratiman-91 opened this issue Jun 6, 2020 · 2 comments
Closed

to_csv add lat and lon if None is selected #3

pratiman-91 opened this issue Jun 6, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@pratiman-91
Copy link
Collaborator

import imdlib as imd

start_yr =2018
end_yr = 2018
variable = 'rain' # other options are ('tmin'/ 'tmax')
data = imd.open_data((start_yr, end_yr), 'rain','yearwise')
data.to_csv('test.csv')
Traceback (most recent call last):
File "", line 1, in
File "C:\ProgramData\Miniconda3\lib\site-packages\imdlib\core.py", line 77, in to_csv
self.lat_array, self.lon_array)
File "C:\ProgramData\Miniconda3\lib\site-packages\imdlib\util.py", line 26, in get_lat_lon
lat_index = np.abs(lat_rage - lat).argmin()
TypeError: unsupported operand type(s) for -: 'float' and 'NoneType'

@pratiman-91 pratiman-91 added the bug Something isn't working label Jun 6, 2020
@iamsaswata
Copy link
Owner

iamsaswata commented Jun 8, 2020

Thanks for reporting it.
This was happening due to there was no support earlier for converting the entire 3D data array to 2D data format (with lat and lon as None).

Now this has been fixed. We have added this feature with 11619a3.
This modification is added at https://github.com/iamsaswata/imdlib/blob/master/imdlib/core.py#L94-L99

@pratiman-91
Copy link
Collaborator Author

Makes sense.

pratiman-91 added a commit that referenced this issue Dec 31, 2020
Merge pull request #9 from pratiman-91/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants