-
Notifications
You must be signed in to change notification settings - Fork 5
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
error exporting the csv file #4
Comments
OK, thanks for the heads-up on clipping I will update the clips to be through geopandas instead of earthpy. For the other issue, I will have to look into it. Will try to get to that this week. |
I think this may be something to do with Fiona? I am able to export the output as a shape file but not as a csv. However, the shape file output does not seem to come with all the columns for some reason. I tried exporting a csv file directly using pandas and that did export a csv file. However, for some reason when I use this as an input in the the OnSSET gep runner code to create a calibrated file it throws an error saying: KeyError: 'NumPeoplePerHH' . Attached are my input file and specs file. Do you think you can help check this one your end? |
Hi Shaky, Apologies, I have not had time to look into this yet. Will try to get it done ASAP. Yes, I can have a look at it your files, however, I do not see anything attached? |
Hi Babak,
No worries. Sorry i think the attachment was too big and failed.
Just shared it to you KTH email from one drive.
Thanks for your help again,
Best,
Shaky
…On Thu, Feb 17, 2022 at 2:53 AM Babak Khavari ***@***.***> wrote:
Hi Shaky,
Apologies, I have not had time to look into this yet. Will try to get it
done ASAP.
Yes, I can have a look at it your files, however, I do not see anything
attached?
—
Reply to this email directly, view it on GitHub
<#4 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFSUROVB6WHHPFXY5LKZ53U3SSPTANCNFSM5NVXYF3Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you modified the open/close state.Message
ID: <babakkhavari/OnSSET_GIS_Extraction_notebook/issues/4/1042664832@
github.com>
|
I do not seem to have received any invitation to one drive through any of my emails. |
Yes, i thought i shared it to the that email. I just shared it again. Let
me know if you got it.
Here is the link to the data folder:
https://worldbankgroup-my.sharepoint.com/:f:/g/personal/ssherpa_worldbank_org/EmZJuvdKx-dCo1tVMmHLlT8BB3oJF2WW64HdEu9YfUp1sQ?email=khavari%40kth.se&e=m8DYyT
…On Fri, Feb 18, 2022 at 7:34 AM Babak Khavari ***@***.***> wrote:
I do not seem to have received any invitation to one drive through any of
my emails. Can you send a shareable link instead to ***@***.***?
—
Reply to this email directly, view it on GitHub
<#4 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFSURIVKMTZUIDSH266IXDU3Y4GHANCNFSM5NVXYF3Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you modified the open/close state.Message
ID: <babakkhavari/OnSSET_GIS_Extraction_notebook/issues/4/1044453704@
github.com>
|
Still nothing through my email. But, I can access the files through your link. I opened your file called output and I see some problems that will make OnSSET crash (see image below) This is because you have the geometry column when exporting. Can you try removing it by first converting your gdf to a df and then export (I think this would force you to export as a csv)? |
Ok so, i did try that. and I am able to run the calibration with it but
however when i run the scenarios i still get the following error:
[image: Screen Shot 2022-02-19 at 12.17.59 AM.png]
I have uploaded the new input file and the calibrated input and specs file
which i then used to run the scenarios.
…On Fri, Feb 18, 2022 at 10:52 AM Babak Khavari ***@***.***> wrote:
Still nothing through my email. But, I can access the files through your
link.
I opened your file called output and I see some immediate problems that
will definitely make OnSSET crash (see image below)
[image: image]
<https://user-images.githubusercontent.com/35455877/154715674-c3e0cbb2-a384-434b-92c8-c29dbc5a4207.png>
This is because you have the geometry column when exporting. Can you try
removing it by first converting your gdf to a df and then export (I think
this would force you to export as a csv)?
—
Reply to this email directly, view it on GitHub
<#4 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFSURI26G6VJPU5E6UIDALU3ZTLNANCNFSM5NVXYF3Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you modified the open/close state.Message
ID: <babakkhavari/OnSSET_GIS_Extraction_notebook/issues/4/1044737601@
github.com>
|
Can you reattach the image? It seems like it did not get included in your previous message. |
Sorry here it is
…On Sat, Feb 19, 2022 at 3:00 AM Babak Khavari ***@***.***> wrote:
Can you reattach the image? It seems like it did not get included in your
previous message.
—
Reply to this email directly, view it on GitHub
<#4 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAFSURMDEVHOUMJEG5Z5LHTU35E2FANCNFSM5NVXYF3Q>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you modified the open/close state.Message
ID: <babakkhavari/OnSSET_GIS_Extraction_notebook/issues/4/1045962519@
github.com>
|
sorry the screenshot is attached
…On Sun, Feb 20, 2022 at 11:18 AM Shaky sherpa ***@***.***> wrote:
Sorry here it is
On Sat, Feb 19, 2022 at 3:00 AM Babak Khavari ***@***.***>
wrote:
> Can you reattach the image? It seems like it did not get included in your
> previous message.
>
> —
> Reply to this email directly, view it on GitHub
> <#4 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AAFSURMDEVHOUMJEG5Z5LHTU35E2FANCNFSM5NVXYF3Q>
> .
> Triage notifications on the go with GitHub Mobile for iOS
> <https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
> or Android
> <https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
>
> You are receiving this because you modified the open/close state.Message
> ID: <babakkhavari/OnSSET_GIS_Extraction_notebook/issues/4/1045962519@
> github.com>
>
|
Hi Bavak, |
Ok, great that it worked. The GDP column is not included in the extraction code that you run, since it is also not used in the default version of OnSSET. In other words it has nothing to do with the custom demand layer. It would perhaps make sense to add it as an optional layer in the extraction code, but this will be done later in that case. |
The code is choking up on this last step. I get a csv output but with only the column headers and empty data values. Below is my error message. Also, just had to replace the clip function from earthpy with clip form geopandas library in funcs.py
FionaCPLError Traceback (most recent call last)
Input In [81], in
----> 1 clusters = conditioning(clusters, workspace, popunit.value)
File /var/folders/3y/qvxb1s8s0nb51g2l7lzv8km00000gn/T/ipykernel_51993/481285332.py:167, in conditioning(clusters, workspace, popunit)
164 clusters["Y_deg"] = clusters.geometry.centroid.y
166 #clusters.to_file(workspace + r"\output.shp", driver='ESRI Shapefile')
--> 167 clusters.to_file(workspace + r"\output.csv", driver='CSV')
168 print(datetime.datetime.now())
169 return clusters
File ~/opt/anaconda3/envs/OnSSET_extraction/lib/python3.10/site-packages/geopandas/geodataframe.py:724, in GeoDataFrame.to_file(self, filename, driver, schema, index, **kwargs)
681 """Write the
GeoDataFrame
to a file.682
683 By default, an ESRI shapefile is written, but any OGR data source
(...)
720 GeoSeries.to_file
721 """
722 from geopandas.io.file import _to_file
--> 724 _to_file(self, filename, driver, schema, index, **kwargs)
File ~/opt/anaconda3/envs/OnSSET_extraction/lib/python3.10/site-packages/geopandas/io/file.py:257, in _to_file(df, filename, driver, schema, index, mode, crs, **kwargs)
253 crs_wkt = crs.to_wkt("WKT1_GDAL")
254 with fiona.open(
255 filename, mode=mode, driver=driver, crs_wkt=crs_wkt, schema=schema, **kwargs
256 ) as colxn:
--> 257 colxn.writerecords(df.iterfeatures())
File ~/opt/anaconda3/envs/OnSSET_extraction/lib/python3.10/site-packages/fiona/collection.py:361, in Collection.writerecords(self, records)
359 if self.mode not in ('a', 'w'):
360 raise IOError("collection not open for writing")
--> 361 self.session.writerecs(records, self)
362 self._len = self.session.get_length()
363 self._bounds = None
File fiona/ogrext.pyx:1291, in fiona.ogrext.WritingSession.writerecs()
File fiona/ogrext.pyx:354, in fiona.ogrext.OGRFeatureBuilder.build()
File fiona/_err.pyx:269, in fiona._err.exc_wrap_int()
FionaCPLError: The wrapped function returned an error code, but no error message was set.
The text was updated successfully, but these errors were encountered: