Hello @gabrieltseng and CropHarvest team,
Actually ı am newbie about usage. what ı did is ı exported a tif file using export_for_labels method:
private_labels = pd.DataFrame({ "lon": [min_lon, max_lon], "lat": [min_lat, max_lat], "start_date": [date(2021, 1, 1), date(2021, 1, 1)], "end_date": [date(2022, 1, 1), date(2022, 1, 1)] }) private_labels google_cloud_exporter.export_for_labels(labels=private_labels)
Until this point, everything is good ı exported tif file succesfully and ı downloaded. After that
ı tried to test my exported tif file in the model here it is:
preds = Inference(model=modelp, normalizing_dict=None).run(local_path = f)
but ı get this error
preds = Inference(model=modelp, normalizing_dict=None).run(local_path = f) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/cropharvest/inference.py", line 89, in run x_np, flat_lat, flat_lon = Engineer.process_test_file(local_path, start_date) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/cropharvest/engineer.py", line 405, in process_test_file da, slope = Engineer.load_tif(path_to_file, start_date=start_date) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/cropharvest/engineer.py", line 236, in load_tif time_specific_da["band"] = range(bands_per_timestep + len(STATIC_BANDS)) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/xarray/core/dataarray.py", line 754, in __setitem__ self.coords[key] = value File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/xarray/core/coordinates.py", line 41, in __setitem__ self.update({key: value}) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/xarray/core/coordinates.py", line 166, in update self._update_coords(coords, indexes) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/xarray/core/coordinates.py", line 342, in _update_coords dims = calculate_dimensions(coords_plus_data) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/xarray/core/dataset.py", line 208, in calculate_dimensions raise ValueError( ValueError: conflicting sizes for dimension 'band': length 4 on <this-array> and length 19 on {'band': 'band', 'y': 'y', 'x': 'x'}
Hello @gabrieltseng and CropHarvest team,
Actually ı am newbie about usage. what ı did is ı exported a tif file using export_for_labels method:
private_labels = pd.DataFrame({ "lon": [min_lon, max_lon], "lat": [min_lat, max_lat], "start_date": [date(2021, 1, 1), date(2021, 1, 1)], "end_date": [date(2022, 1, 1), date(2022, 1, 1)] }) private_labels google_cloud_exporter.export_for_labels(labels=private_labels)Until this point, everything is good ı exported tif file succesfully and ı downloaded. After that
ı tried to test my exported tif file in the model here it is:
preds = Inference(model=modelp, normalizing_dict=None).run(local_path = f)but ı get this error
preds = Inference(model=modelp, normalizing_dict=None).run(local_path = f) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/cropharvest/inference.py", line 89, in run x_np, flat_lat, flat_lon = Engineer.process_test_file(local_path, start_date) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/cropharvest/engineer.py", line 405, in process_test_file da, slope = Engineer.load_tif(path_to_file, start_date=start_date) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/cropharvest/engineer.py", line 236, in load_tif time_specific_da["band"] = range(bands_per_timestep + len(STATIC_BANDS)) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/xarray/core/dataarray.py", line 754, in __setitem__ self.coords[key] = value File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/xarray/core/coordinates.py", line 41, in __setitem__ self.update({key: value}) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/xarray/core/coordinates.py", line 166, in update self._update_coords(coords, indexes) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/xarray/core/coordinates.py", line 342, in _update_coords dims = calculate_dimensions(coords_plus_data) File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/xarray/core/dataset.py", line 208, in calculate_dimensions raise ValueError( ValueError: conflicting sizes for dimension 'band': length 4 on <this-array> and length 19 on {'band': 'band', 'y': 'y', 'x': 'x'}