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

Create raster layer from file #92

Merged
merged 2 commits into from
Jul 27, 2022

Conversation

wang-boyu
Copy link
Member

Partly addresses #91.

The support for compressed files requires more effort, so I'm thinking to implement that in the next release. That probably won't be a breaking change, i.e., from

RasterLayer.from_file(raster_file, cell_cls=Cell, attr_name=None)

to

RasterLayer.from_file(raster_file, cell_cls=Cell, attr_name=None, compression="infer")

@codecov
Copy link

codecov bot commented Jul 27, 2022

Codecov Report

Merging #92 (94cf2d0) into main (93e8d60) will increase coverage by 0.70%.
The diff coverage is 94.11%.

@@            Coverage Diff             @@
##             main      #92      +/-   ##
==========================================
+ Coverage   78.57%   79.28%   +0.70%     
==========================================
  Files           7        7              
  Lines         574      584      +10     
  Branches       97       98       +1     
==========================================
+ Hits          451      463      +12     
+ Misses        107      105       -2     
  Partials       16       16              
Impacted Files Coverage Δ
mesa_geo/raster_layers.py 72.41% <94.11%> (+2.14%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 93e8d60...94cf2d0. Read the comment docs.

@wang-boyu wang-boyu force-pushed the feat/raster-layer-from-file branch from 460dcb8 to 94cf2d0 Compare July 27, 2022 01:37
@rht
Copy link
Contributor

rht commented Jul 27, 2022

We should be consistently use verb for function/method name. E.g. pd.read_csv.

@wang-boyu
Copy link
Member Author

To me read_file is better when it's from the package level, e.g., pd.read_csv, gpd.read_file, whereas from_file sounds more natural for class method constructors, e.g., pd.DataFrame.from_dict, gpd.GeoDataFrame.from_file.

But this is just my personal preference.

@wang-boyu
Copy link
Member Author

Shall I rename to RasterLayer.read_file then?

@rht
Copy link
Contributor

rht commented Jul 27, 2022

For the pandas naming, it is not conclusive that they use read_* convention because it is for package level functions. But given that geopandas already uses from_file, then we have to follow suite, according to the principle of least surprise.

@rht rht merged commit 00cfc35 into projectmesa:main Jul 27, 2022
@wang-boyu wang-boyu deleted the feat/raster-layer-from-file branch July 27, 2022 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants