def test_scene_available_datasets(self): """Test that datasets are available.""" scene = Scene(reader='modis_l2', filenames=[self.file_name]) available_datasets = scene.all_dataset_names() self.assertTrue(len(available_datasets) > 0) self.assertIn('cloud_mask', available_datasets) self.assertIn('latitude', available_datasets) self.assertIn('longitude', available_datasets)
def test_scene_available_datasets(self, modis_l2_nasa_mod35_file): """Test that datasets are available.""" scene = Scene(reader='modis_l2', filenames=modis_l2_nasa_mod35_file) available_datasets = scene.all_dataset_names() assert len(available_datasets) > 0 assert 'cloud_mask' in available_datasets assert 'latitude' in available_datasets assert 'longitude' in available_datasets
['__class__', '__contains__', '__delattr__', '__delitem__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__iter__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_check_known_composites', '_compare_areas', '_compute_metadata_from_readers', '_generate_composite', '_get_prereq_datasets', '_get_sensor_names', '_ipython_key_completions_', '_read_composites', '_read_datasets', '_remove_failed_datasets', '_resampled_scene', '_slice_area_from_bbox', '_slice_data', '_slice_datasets', 'aggregate', 'all_composite_ids', 'all_composite_names', 'all_dataset_ids', 'all_dataset_names', 'all_modifier_names', 'all_same_area', 'all_same_proj', 'attrs', 'available_composite_ids', 'available_composite_names', 'available_dataset_ids', 'available_dataset_names', 'copy', 'cpl', 'create_reader_instances', 'crop', 'datasets', 'dep_tree', 'end_time', 'generate_composites', 'get', 'get_writer_by_ext', 'id', 'images', 'iter_by_area', 'keys', 'load', 'max_area', 'min_area', 'missing_datasets', 'ppp_config_dir', 'read', 'readers', 'resample', 'resamplers', 'save_dataset', 'save_datasets', 'show', 'slice', 'start_time', 'to_geoviews', 'to_xarray_dataset', 'unload', 'values', 'wishlist'] """ #!!# print(global_scene['overview']) ### this one does only work in the develop version print("") print("available_composite_names") print(global_scene.available_composite_names()) print(global_scene.all_dataset_names()) print(global_scene.available_dataset_names()) print(global_scene.datasets) # resample to another projection print("resample") area = "ccs4" area = "EuropeCanaryS95" local_scene = global_scene.resample(area) print("dir(local_scene)", dir(local_scene)) for p_name in nwcsaf.product[p_]: #local_scene.show('cloudtype') #local_scene.save_dataset('cloudtype', './local_cloudtype.png') #print "display ./local_cloudtype.png &"
#------------------------------------------------------------------------------ # 2 CROP TO LOCAL EXTENT AND WRITE AS GEOTIFF #------------------------------------------------------------------------------ for files in filelist: if files.endswith(fileEnding): filename = [os.path.join(workingDir, files)] #read the data #------------- #specify reader for the respective file type (here CM-SAF Claas 2 reader) #available from satpy 0.22 onwards, has to be installed using conda forge channel scnFile = {"cmsaf-claas2_l2_nc": filename} scn = Scene(filenames=scnFile) #show all available channels #scn.all_dataset_names() channel = scn.all_dataset_names()[3] #load the ct channel scn.load([channel]) #scn[channel] #scn.show(channel) scn.available_composite_names() #crop the scene using the coordinates of the RADOLAN boundary (DWD 2004) #more in northern and southern direction because no perfect overlap after reprojection #crop function: ll_bbox=(xmin, ymin, xmax, ymax) #https://satpy.readthedocs.io/en/latest/api/satpy.html?highlight=crop#satpy.scene.Scene.crop scn_cropped = scn.crop(ll_bbox=(3.6, 46.7, 15.7, 55.2)) #y_original:ymin:47, ymax:54.7 scn_cropped.show(channel) scn_cropped.save_datasets(writer="geotiff",
def test_scene_available_datasets(self, input_files): """Test that datasets are available.""" scene = Scene(reader='seadas_l2', filenames=input_files) available_datasets = scene.all_dataset_names() assert len(available_datasets) > 0 assert 'chlor_a' in available_datasets