-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Add EarthScienceToolkit (about 100 specific earth science tools) from Earth-Agent Paper #3345
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
base: master
Are you sure you want to change the base?
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
thanks @Peilin-FF for the PR! |
|
@Peilin-FF I noticed that you have also released the Earth-Bench benchmark. It would be great if we could include this benchmark in our Camel AI benchmarks folder. Thanks |
| Returns: | ||
| str: Path to the saved NDVI file. | ||
| """ | ||
| with rasterio.open(input_nir_path) as nir_src: | ||
| nir_band = nir_src.read(1) | ||
| nir_profile = nir_src.profile | ||
| with rasterio.open(input_red_path) as red_src: | ||
| red_band = red_src.read(1) | ||
| nir_band = np.array(nir_band, dtype=np.float32) | ||
| red_band = np.array(red_band, dtype=np.float32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To prevent errors when agent provide non-existent file paths, it would be beneficial to add validation checks for the input paths before processing.
| blue_band = np.array(blue_band, dtype=np.float32) | ||
| denominator = nir_band + C1 * red_band - C2 * blue_band + L + 1e-06 | ||
| evi = G * (nir_band - red_band) / denominator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| blue_band = np.array(blue_band, dtype=np.float32) | |
| denominator = nir_band + C1 * red_band - C2 * blue_band + L + 1e-06 | |
| evi = G * (nir_band - red_band) / denominator | |
| blue_band = np.array(blue_band, dtype=np.float32) | |
| denominator = nir_band + (C1 * red_band) - (C2 * blue_band) + L + 1e-06 | |
| evi = G * (nir_band - red_band) / denominator |
fengju0213
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for this amazing pr! left some comments below
| """A class representing a toolkit for earth obseravation science. | ||
|
|
||
| This class provides 104 basic methods for earth observation problem solutions which can be divided into | ||
| Index(12 functions), Inversion(18 functions), Perception(15 functions), Analysis(10 functions), and Statistics(49 functions). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since you already classified these tools ,could we add a parameter during the init process to determine which functions are returned in categories during get_tools? Adding around 100 function at once might incur some performance penalty, but as a professional, you can help us identify and categorize these specialized functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean that returning 100 tools with get_tools would cause a performance loss, so you would like to add a parameter to return functions from a specific category? For example, if the input parameter is an index, it would only return 12 functions from category index?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes,exactly
| dst.write(ndvi.astype(rasterio.float32), 1) | ||
| return f'Result save at {TEMP_DIR / output_path}' | ||
|
|
||
| def calculate_batch_ndvi(self, input_nir_paths: list[str], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
|
||
| @MCPServer() | ||
| class EarthScienceToolkit(BaseToolkit): | ||
| """A class representing a toolkit for earth obseravation science. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| """A class representing a toolkit for earth obseravation science. | |
| r"""A class representing a toolkit for earth obseravation science. |
|
@Peilin-FF could you alse add some example to show how to use this awesome toolkit? maybe you can demonstrate different function combinations to suit different scenarios. |
Ok,are there any guidelines for adding benchmarks? |
Sure, I will update it for you soon :) |
waleedalzarooni
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @Peilin-FF awesome contribution!
Just a few comments from me, bulk of the work is done to a great standard so well done!
| from scipy.stats import linregress | ||
| from scipy.stats import norm | ||
| import matplotlib.cm as cm | ||
| TEMP_DIR = Path('/tmp/earth_science') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The path /tmp/earth_science is a Unix/Linux/macOS-specific path. Windows doesn't have a /tmp directory by default.
Recommendation: Use tempfile.mkdtemp() or make it configurable:
import tempfile
TEMP_DIR = Path(os.getenv('EARTH_SCIENCE_TEMP_DIR', tempfile.gettempdir()))
/ 'earth_science'
| @@ -0,0 +1,4508 @@ | |||
| import warnings | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also typically include test and example files for newly added toolkits, reference Contributing.MD to see what supplementary files are added when toolkits are created!
| Index(12 functions), Inversion(18 functions), Perception(15 functions), Analysis(10 functions), and Statistics(49 functions). | ||
| """ | ||
|
|
||
| def calculate_ndvi(self, input_nir_path, input_red_path, output_path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some methods have type hints, some don't at the moment. Would be great if you could include complete type hints for all methods to maintain quality in the codebase.
@Peilin-FF for benchmark you can refer to this pr #2293 |

Description
Conghui He and Weijia Li's team from the Shanghai AI Laboratory introduced the Earth-Agent framework in the paper titled "Earth-Agent: Unlocking the Full Landscape of Earth Observation with Agents" (https://arxiv.org/pdf/2509.23141). This paper introduces the first Agent framework for the Earth Observation domain and has developed over 100 Earth Science-specific tools based on the MCP. We have defined these tools according to Camel's MCP specification and integrated them into the Camel repository, which is well-known within the community. We hope to enhance the Camel tool system and foster the development of Earth-Agent within the Camel community :)
This issue Link: Issues
Checklist
Go over all the following points, and put an
xin all the boxes that apply.Fixes #issue-numberin the PR description (required)pyproject.tomlanduv lockIf you are unsure about any of these, don't hesitate to ask. We are here to help!