4747}
4848
4949
50- def check_point_cloud_args (mode , point_cloud_args_in ):
50+ def check_point_cloud_args (source , mode , point_cloud_args_in ):
5151 if mode == "time" :
5252 raise ValueError ("This mode will be implemented soon" )
5353 if mode == "classes" :
@@ -73,9 +73,30 @@ def check_point_cloud_args(mode, point_cloud_args_in):
7373 if key is not None :
7474 point_cloud_args [key ] = point_cloud_args_in .pop (key )
7575
76- if not "height" in point_cloud_args :
77- point_cloud_args ["height" ] = 600
78- point_cloud_args ["width" ] = 800
76+ def in_pixels (h , default ):
77+ if h is None :
78+ return default
79+ if isinstance (h , str ):
80+ if "px" in h :
81+ return h
82+ return h + "px"
83+ if isinstance (h , int ):
84+ return str (h ) + "px"
85+ if isinstance (h , float ):
86+ return str (int (h )) + "px"
87+
88+ point_cloud_args ["height" ] = in_pixels (point_cloud_args .get ("height" ), "500px" )
89+ point_cloud_args ["width" ] = in_pixels (point_cloud_args .get ("width" ), "700px" )
90+
91+ if not "token" in point_cloud_args :
92+ try :
93+ token = os .getenv ("TILEDB_REST_TOKEN" )
94+ except :
95+ if source == "cloud" & token == None :
96+ raise ValueError (
97+ "The TileDB Cloud token needed to access the array is not specified or cannot be accessed"
98+ )
99+ point_cloud_args = {** point_cloud_args , "token" : token }
79100
80101 return point_cloud_args
81102
@@ -121,14 +142,6 @@ def check_point_cloud_data_local(mode, uri, point_cloud_args):
121142
122143
123144def check_point_cloud_data_cloud (streaming , uri , point_cloud_args ):
124- if not "token" in point_cloud_args :
125- token = os .getenv ("TILEDB_REST_TOKEN" )
126- if token == None :
127- raise ValueError (
128- "The TileDB Cloud token needed to access the array is not specified or cannot be accessed"
129- )
130- point_cloud_args = {** point_cloud_args , "token" : token }
131-
132145 o = urlparse (uri )
133146
134147 if not streaming :
0 commit comments