How to use create_variable method in autotest

Best Python code snippet using autotest_python

values_v2_test.py

Source:values_v2_test.py Github

copy

Full Screen

...32 # all defined. It verifies methods and properties that have the same code path33 # under different replicas/devices as well. It is not intended to verify34 # methods and properties that behave differently under different35 # replicas/devices; those should be covered separate tests.36 def create_variable(self, initial_value=1., **kwargs):37 raise NotImplementedError38 @property39 def devices(self):40 return ["CPU:0", "CPU:1"]41 # ==== Begin Variable interface ===42 # Please follow the same order as methods and properties defined in43 # tf.Variable.44 def testStringify(self):45 v = self.create_variable()46 self.assertIsInstance(v.__str__(), str)47 self.assertIsInstance(v.__repr__(), str)48 def testDenseRead(self):49 v = self.create_variable(1.)50 self.assertEqual(v.value(), 1.)51 self.assertEqual(v.read_value(), 1.)52 def testShape(self):53 v = self.create_variable([1.])54 self.assertEqual(v.shape, (1,))55 self.assertEqual(v.get_shape(), (1,))56 v.set_shape((1,))57 with self.assertRaisesRegex(ValueError, "not compatible"):58 v.set_shape((1, 1))59 @combinations.generate(combinations.combine(trainable=[True, False]))60 def testTrainable(self, trainable):61 v = self.create_variable(trainable=trainable)62 self.assertEqual(v.trainable, trainable)63 @combinations.generate(64 combinations.combine(synchronization=[65 variables_lib.VariableSynchronization.ON_READ,66 variables_lib.VariableSynchronization.ON_WRITE,67 variables_lib.VariableSynchronization.AUTO,68 variables_lib.VariableSynchronization.NONE,69 ]))70 def testSynchronization(self, synchronization):71 v = self.create_variable(synchronization=synchronization)72 self.assertEqual(v.synchronization, synchronization)73 @combinations.generate(74 combinations.combine(aggregation=[75 variables_lib.VariableAggregation.MEAN,76 variables_lib.VariableAggregation.SUM,77 variables_lib.VariableAggregation.ONLY_FIRST_REPLICA,78 variables_lib.VariableAggregation.NONE,79 ]))80 def testAggregation(self, aggregation):81 v = self.create_variable(aggregation=aggregation)82 self.assertEqual(v.aggregation, aggregation)83 @combinations.generate(combinations.combine(mode="graph"))84 def testEval(self):85 v = self.create_variable(1.)86 with self.cached_session():87 self.evaluate(variables_lib.global_variables_initializer())88 self.assertEqual(v.eval(), 1.)89 def testInitialValueEager(self):90 v = self.create_variable(1.)91 with self.assertRaises(RuntimeError):92 v.initial_value # pylint: disable=pointless-statement93 @combinations.generate(combinations.combine(mode="graph"))94 def testInitialValueGraph(self):95 v = self.create_variable(1.)96 self.assertEqual(self.evaluate(v.initial_value), 1.)97 def testConstraint(self):98 v = self.create_variable(constraint=lambda x: x + 1.)99 self.assertEqual(v.constraint(1.), 2.)100 def testDenseUpdate(self):101 v = self.create_variable(1.)102 self.assertEqual(103 v.assign(2., use_locking=True, name="assign", read_value=True), 2.)104 self.assertIsNone(v.assign(3., read_value=False))105 self.assertEqual(v, 3.)106 self.assertEqual(107 v.assign_add(1., use_locking=True, name="assign_add", read_value=True),108 4.)109 self.assertIsNone(v.assign_add(1., read_value=False))110 self.assertEqual(v, 5.)111 self.assertEqual(112 v.assign_sub(1., use_locking=True, name="assign_sub", read_value=True),113 4.)114 self.assertIsNone(v.assign_sub(1., read_value=False))115 self.assertEqual(v, 3.)116 @def_function.function117 def f():118 self.assertIsInstance(v.assign(1., read_value=False), ops.Operation)119 self.assertIsInstance(v.assign_add(1., read_value=False), ops.Operation)120 self.assertIsInstance(v.assign_sub(1., read_value=False), ops.Operation)121 f()122 def testSparseUpdate(self):123 v = self.create_variable([0., 0., 0.])124 self.assertAllEqual(125 v.scatter_add(126 _make_index_slices(values=[1., 2.], indices=[0, 2]),127 use_locking=True,128 name="add"), [1., 0., 2.])129 self.assertAllEqual(130 v.scatter_div(131 _make_index_slices(values=[4., 2.], indices=[0, 2]),132 use_locking=True,133 name="div"), [0.25, 0., 1.])134 self.assertAllEqual(135 v.scatter_max(136 _make_index_slices(values=[1., 0.5], indices=[1, 2]),137 use_locking=True,138 name="max"), [0.25, 1., 1.])139 self.assertAllEqual(140 v.scatter_min(141 _make_index_slices(values=[1., 0.5], indices=[0, 1]),142 use_locking=True,143 name="min"), [0.25, 0.5, 1.])144 self.assertAllEqual(145 v.scatter_mul(146 _make_index_slices(values=[2., 0.5], indices=[0, 1]),147 use_locking=True,148 name="mul"), [0.5, 0.25, 1.])149 self.assertAllEqual(150 v.scatter_sub(151 _make_index_slices(values=[2., 0.5], indices=[0, 1]),152 use_locking=True,153 name="sub"), [-1.5, -0.25, 1.])154 self.assertAllEqual(155 v.scatter_update(156 _make_index_slices(values=[2., 0.5], indices=[0, 1]),157 use_locking=True,158 name="update"), [2., 0.5, 1.])159 self.assertAllEqual(160 v.batch_scatter_update(161 _make_index_slices(values=[1., 1.5], indices=[0, 1]),162 use_locking=True,163 name="update"), [1., 1.5, 1.])164 def testSparseNdUpdate(self):165 v = self.create_variable([0., 0., 0., 0.])166 self.assertAllEqual(167 v.scatter_nd_sub([[3], [1]], [1., 2.], name="sub"), [0., -2., 0., -1.])168 self.assertAllEqual(169 v.scatter_nd_add([[2], [0]], [1., 2.], name="add"), [2., -2., 1., -1.])170 self.assertAllEqual(171 v.scatter_nd_update([[1], [3]], [3., 3.], name="update"),172 [2., 3., 1., 3.])173 def testSparseRead(self):174 v = self.create_variable([[1., 2.], [3., 4.]])175 self.assertAllEqual(176 v.sparse_read([1, 0], name="read"), [[3., 4.], [1., 2.]])177 self.assertAllEqual(178 v.gather_nd([[1, 0], [0, 1]], name="gather_nd"), [3., 2.])179 def testTensorConversion(self):180 v = self.create_variable([1.])181 self.assertEqual(ops.convert_to_tensor(v), [1.])182 def testHash(self):183 v = self.create_variable()184 w = self.create_variable()185 d = {}186 with self.assertRaises(TypeError):187 d[v] = 1188 d[v.ref()] = 1189 self.assertEqual(d[v.ref()], 1)190 self.assertNotIn(w.ref(), d)191 @combinations.generate(combinations.combine(mode="graph"))192 def testHashGraph(self):193 v = self.create_variable()194 w = self.create_variable()195 d = {v: 1}196 self.assertEqual(d[v], 1)197 self.assertNotIn(w, d)198 def testEquality(self):199 v = self.create_variable(1.)200 w = self.create_variable(2.)201 x = self.create_variable(1.)202 self.assertEqual(v, x)203 self.assertNotEqual(v, w)204 @combinations.generate(combinations.combine(mode="graph"))205 def testEqualityGraph(self):206 # In legacy graph mode, tensor equality is object equality207 v = self.create_variable(1.)208 w = self.create_variable(1.)209 self.assertNotEqual(v, w)210 self.assertEqual(v, v)211 def testIteration(self):212 v = self.create_variable([1.])213 self.assertEqual([1.], list(iter(v)))214 def testProperties(self):215 v = self.create_variable()216 self.assertIsInstance(v.name, str)217 # _shared_name is also part of the interface. E.g. it's used in optimizer to218 # determine slot variable key.219 self.assertIsInstance(v._shared_name, str)220 self.assertIsNone(v.initializer)221 self.assertIsInstance(v.device, str)222 self.assertEqual(v.dtype, dtypes.float32)223 with self.assertRaises(AttributeError):224 v.op # pylint: disable=pointless-statement225 with self.assertRaises(AttributeError):226 v.graph # pylint: disable=pointless-statement227 @combinations.generate(combinations.combine(mode="graph"))228 def testPropertiesGraph(self):229 v = self.create_variable()230 self.assertIsInstance(v.initializer, ops.Operation)231 self.assertIsInstance(v.op, ops.Operation)232 self.assertIsInstance(v.graph, ops.Graph)233 def testProtoConversion(self):234 # to_proto and from_proto are not supported.235 v = self.create_variable([1, 2])236 with self.assertRaises(TypeError):237 v.to_proto()238 with self.assertRaises(TypeError):239 v.from_proto(variable_def=None)240 def testSaveSliceInfo(self):241 v = self.create_variable()242 slice_info = variables_lib.Variable.SaveSliceInfo()243 v._set_save_slice_info(slice_info)244 self.assertIs(v._get_save_slice_info(), slice_info)245 # Some code accesses _save_slice_info directly without using the getter.246 self.assertIs(v._save_slice_info, slice_info)247 def testOperatorOverride(self):248 v = self.create_variable(7)249 self.assertEqual(v + 1, 8)250 self.assertEqual(3 + v, 10)251 self.assertEqual(v + v, 14)252 self.assertEqual(v - 2, 5)253 self.assertEqual(13 - v, 6)254 self.assertEqual(v - v, 0)255 self.assertEqual(v * 2, 14)256 self.assertEqual(3 * v, 21)257 self.assertEqual(v * v, 49)258 self.assertEqual(v / 2, 3.5)259 self.assertEqual(14 / v, 2.)260 self.assertEqual(v // 2, 3)261 self.assertEqual(15 // v, 2)262 self.assertEqual(v % 2, 1)263 self.assertEqual(16 % v, 2)264 # pylint: disable=g-generic-assert265 self.assertTrue(v < 12)266 self.assertTrue(v <= 12)267 self.assertFalse(v > 12)268 self.assertFalse(v >= 12)269 self.assertFalse(12 < v)270 self.assertFalse(12 <= v)271 self.assertTrue(12 > v)272 self.assertTrue(12 >= v)273 # pylint: enable=g-generic-assert274 self.assertEqual(v & 3, 3)275 self.assertEqual(11 & v, 3)276 self.assertEqual(v | 8, 15)277 self.assertEqual(16 | v, 23)278 self.assertEqual(v ^ 3, 4)279 self.assertEqual(11 ^ v, 12)280 self.assertEqual(pow(v, 3), 343)281 # TODO(b/178748613): pow(v, 3, 10) fails.282 self.assertEqual(pow(2, v), 128)283 self.assertEqual(-v, -7)284 self.assertEqual(~v, ~7)285 self.assertEqual(abs(v), 7)286 def testSlice(self):287 v = self.create_variable([1., 2., 3.])288 self.assertEqual(v[1], 2.)289 v[2].assign(4.)290 self.assertAllEqual(v, [1., 2., 4.])291 # ==== End Variable interface ===292 # ==== Begin ResourceVariable interface ===293 def testHandle(self):294 v = self.create_variable()295 self.assertIsInstance(v.handle, ops.Tensor)296 self.assertEqual(v.handle.dtype, dtypes.resource)297 def testInGraphMode(self):298 # This is protected but used in a lot of places internally.299 v = self.create_variable()300 self.assertFalse(v._in_graph_mode)301 def testUniqueId(self):302 # This is used in optimizer as part of slot variable key.303 v = self.create_variable()304 w = self.create_variable()305 self.assertNotEqual(v._unique_id, w._unique_id)306 def testIsResourceVariable(self):307 v = self.create_variable()308 self.assertTrue(resource_variable_ops.is_resource_variable(v))309 # ==== End ResourceVariable interface ===310 @combinations.generate(combinations.combine(mode="graph"))311 def testAsGraphElement(self):312 g = ops.Graph()313 with g.as_default():314 v = self.create_variable(1.)315 g.finalize()316 self.evaluate(v.initializer)317 # _as_graph_element shouldn't create new operations.318 self.assertEqual(self.evaluate(v._as_graph_element()), 1.)319class DistributedVariableInterfaceTest(_VariableInterfaceTestBase):320 def create_variable(self, initial_value=1., **kwargs):321 variables = []322 for device in self.devices:323 with ops.device(device):324 variables.append(325 variables_lib.Variable(initial_value, **kwargs))326 return values_v2.DistributedVariable(variables)327# Prevent the base class from running.328del _VariableInterfaceTestBase329@combinations.generate(330 combinations.combine(331 strategy=[332 strategy_combinations.tpu_strategy,333 strategy_combinations.mirrored_strategy_with_two_cpus,334 strategy_combinations.mirrored_strategy_with_two_gpus,335 ],336 enable_packed_handle=[True, False],337 tf_function=[combinations.tf_function, combinations.no_tf_function]))338class DistributedVariableTest(test.TestCase, parameterized.TestCase):339 def create_variable(self, strategy, initial_value, enable_packed_handle,340 **kwargs):341 variables = []342 for device in strategy.extended.parameter_devices:343 with ops.device(device):344 variables.append(variables_lib.Variable(initial_value, **kwargs))345 return values_v2.DistributedVariable(346 variables, enable_packed_handle=enable_packed_handle)347 def assertReplica(self, distributed_var, values):348 for var, value in zip(distributed_var._variables, values):349 self.assertAllEqual(var, value)350 def testRead(self, strategy, enable_packed_handle, tf_function):351 v = self.create_variable(strategy, 0., enable_packed_handle)352 with ops.device(strategy.extended.parameter_devices[0]):353 v.assign(1.)354 with ops.device(strategy.extended.parameter_devices[1]):355 v.assign(2.)356 @tf_function357 def read_device0():358 with ops.device(strategy.extended.parameter_devices[0]):359 return v.read_value(), v.value()360 @tf_function361 def read_device1():362 with ops.device(strategy.extended.parameter_devices[1]):363 return v.read_value(), v.value()364 @tf_function365 def read_other_device():366 with ops.device("CPU:0"):367 return v.read_value(), v.value()368 self.assertAllEqual(read_device0(), [1., 1.])369 self.assertAllEqual(read_device1(), [2., 2.])370 self.assertAllEqual(read_other_device(), [1., 1.])371 def testAssign(self, strategy, enable_packed_handle, tf_function):372 v = self.create_variable(strategy, 0., enable_packed_handle)373 @tf_function374 def update_device0():375 with ops.device(strategy.extended.parameter_devices[0]):376 v.assign(1.)377 @tf_function378 def update_device1():379 with ops.device(strategy.extended.parameter_devices[1]):380 v.assign(2.)381 update_device0()382 update_device1()383 self.assertReplica(v, [1., 2.])384 with ops.device("CPU:0"):385 # Update the primary replica.386 v.assign(3.)387 self.assertReplica(v, [3., 2.])388 def testStrategyRun(self, strategy, enable_packed_handle, tf_function):389 if (test_util.is_tpu_strategy(strategy) and390 tf_function is combinations.no_tf_function):391 self.skipTest("tpu doesn't support eager")392 v = self.create_variable(strategy, 0., enable_packed_handle)393 @tf_function394 def update(per_replica):395 v.assign(per_replica)396 @tf_function397 def read():398 return v.read_value()399 strategy.run(400 update, args=(test_util.create_per_replica(strategy, [1., 2.]),))401 self.assertReplica(v, [1., 2.])402 self.assertAllEqual(403 test_util.gather(strategy, strategy.run(read)), [1., 2.])404def _make_index_slices(values, indices, dense_shape=None):405 if dense_shape:406 dense_shape = array_ops.identity(dense_shape)...

Full Screen

Full Screen

zebra.py

Source:zebra.py Github

copy

Full Screen

...191 variable.set_domain(domain)192 solution = reduced_problem.domain_splitting() #recursive call193 if solution: #if the solution is None (cf base case 1), this is False194 return solution195def create_variable(name, id):196 return Variable(name, id, Domain([1, 2, 3, 4, 5]))197#create variables198country1 = "Spain"199country2 = "Ukraine"200country3 = "Japan"201country4 = "Norway"202country5 = "England"203norvegian = create_variable("Norvegian", country4)204spaniard = create_variable("Spain", country1)205englishdude = create_variable("England", country5)206ukrainian = create_variable("Ukraine", country2)207japanese = create_variable("Japan", country3)208country_list = [norvegian, spaniard, englishdude, ukrainian, japanese]209color1 = "blue"210color2 = "green"211color3 = "ivory"212color4 = "red"213color5 = "yellow"214blue = create_variable("blue", color1)215green = create_variable("green", color2)216ivory = create_variable("ivory", color3)217red = create_variable("red", color4)218yellow = create_variable("yellow", color5)219color_list = [blue, green, ivory, red, yellow]220pet1 = "dog"221pet2 = "snails"222pet3 = "fox"223pet4 = "horse"224pet5 = "zebra"225dog = create_variable("dog", pet1)226snail = create_variable("snails", pet2)227fox = create_variable("fox", pet3)228horse = create_variable("horse", pet4)229zebra = create_variable("zebra", pet5)230pet_list = [dog, snail, fox, horse, zebra]231bev1 = "coffee"232bev2 = "milk"233bev3 = "tea"234bev4 = "orange"235bev5 = "water"236coffee = create_variable("coffee", bev1)237milk = create_variable("milk", bev2)238tea = create_variable("tea", bev3)239orange = create_variable("orange", bev4)240water = create_variable("water", bev5)241bev_list = [coffee, milk, tea, orange, water]242game1 = 'Snakes and Ladders'243game2 = 'Cluedo'244game3 = 'Pictionary'245game4 = 'Travel the World'246game5 = 'Backgammon'247snakes_and_ladders = create_variable("Snakes and Ladders", game1)248cluedo = create_variable("Cluedo", game2)249pictionary = create_variable("Pictionary", game3)250travel_the_world = create_variable("Travel the World", game4)251backgammon = create_variable("Backgammon", game5)252game_list = [snakes_and_ladders, cluedo, pictionary, travel_the_world, backgammon]253#create constraints254constraint_list = [Constraint_equality_var_var(englishdude, red),255 Constraint_equality_var_var(spaniard, dog),256 Constraint_equality_var_var(coffee, green),257 Constraint_equality_var_var(ukrainian, tea),258 Constraint_equality_var_plus_cons(green, ivory, 1),259 Constraint_equality_var_var(snakes_and_ladders, snail),260 Constraint_equality_var_var(cluedo, yellow),261 Constraint_equality_var_cons(milk, 3),262 Constraint_equality_var_cons(norvegian, 1),263 Constraint_equality_plus_minus_cons(pictionary, fox, 1),264 Constraint_equality_plus_minus_cons(cluedo, horse, 1),265 Constraint_equality_var_var(travel_the_world, orange),...

Full Screen

Full Screen

Output.py

Source:Output.py Github

copy

Full Screen

...138 # Append priors139 append_variables(priors, dataset)140 # Append river type as NA and assign fill value to invalid reaches141 if not valid:142 create_variable(dataset["node"], "river_type", "Brinkerhoff_class_number", "NA", priors["river_type"])143 dataset["reach/Qhat"].assignValue(Output.FILL_VALUE)144 dataset["reach/Qsd"].assignValue(Output.FILL_VALUE)145 else:146 # Create nx dimension and coordinate variable and append vector 147 create_nx(np.shape(priors["river_type"]), dataset)148 append_river_type(priors, dataset)149 # Set global attribute flag for validity150 dataset.valid = np.uint32(1) if valid else np.uint32(0)151 # Close NetCDF4 dataset152 dataset.close()153def append_variables(priors, dataset):154 """ Appends NetCDF4 variables for geoBAM priors to reach group."""155 # Retrieve reach group156 reach_grp = dataset["reach"]157 # Create variables for each prior158 create_variable(reach_grp, "lowerbound_A0", "Median_area_min", "m^2", priors["lowerbound_A0"])159 create_variable(reach_grp, "upperbound_A0", "Median_area_max", "m^2", priors["upperbound_A0"])160 create_variable(reach_grp, "lowerbound_logn", "Mannings_n_min", "NA", priors["lowerbound_logn"])161 create_variable(reach_grp, "upperbound_logn", "Mannings_n_max", "NA", priors["upperbound_logn"])162 create_variable(reach_grp, "lowerbound_b", "AHG_b_min", "NA", priors["lowerbound_b"])163 create_variable(reach_grp, "upperbound_b", "AHG_b_max", "NA", priors["upperbound_b"])164 create_variable(reach_grp, "lowerbound_logWb", "Bankfull_width_min", "m", priors["lowerbound_logWb"])165 create_variable(reach_grp, "upperbound_logWb", "Bankfull_width_max", "m", priors["upperbound_logWb"])166 create_variable(reach_grp, "lowerbound_logDb", "Bankfull_depth_min", "m", priors["lowerbound_logDb"])167 create_variable(reach_grp, "upperbound_logDb", "Bankfull_depth_max", "m", priors["upperbound_logDb"])168 create_variable(reach_grp, "lowerbound_logr", "Dingman_shape_min", "NA", priors["lowerbound_logr"])169 create_variable(reach_grp, "upperbound_logr", "Dingman_shape_max", "NA", priors["upperbound_logr"])170 create_variable(reach_grp, "logA0_hat", "Median_area_mean", "m^2", priors["logA0_hat"])171 create_variable(reach_grp, "logn_hat", "Mannings_n_mean", "NA", priors["logn_hat"])172 create_variable(reach_grp, "b_hat", "AHG_b_mean", "NA", priors["b_hat"])173 create_variable(reach_grp, "logWb_hat", "Bankfull_width_mean", "m", priors["logWb_hat"])174 create_variable(reach_grp, "logDb_hat", "Bankfull_depth_mean", "m", priors["logDb_hat"])175 create_variable(reach_grp, "logr_hat", "Dingman_shape_mean", "NA", priors["logr_hat"])176 create_variable(reach_grp, "logA0_sd", "Median_area_sd", "m^2", priors["logA0_sd"])177 create_variable(reach_grp, "logn_sd", "Mannings_n_sd", "NA", priors["logn_sd"])178 create_variable(reach_grp, "b_sd", "AHG_b_sd", "NA", priors["b_sd"])179 create_variable(reach_grp, "logWb_sd", "Bankfull_width_sd", "m", priors["logWb_sd"])180 create_variable(reach_grp, "logDb_sd", "Bankfull_depth_sd", "m", priors["logDb_sd"])181 create_variable(reach_grp, "logr_sd", "Dingman_shape_sd", "NA", priors["logr_sd"])182 create_variable(reach_grp, "lowerbound_logQ", "Discharge_min", "m^3/s", priors["lowerbound_logQ"])183 create_variable(reach_grp, "upperbound_logQ", "Discharge_max", "m^3/s", priors["upperbound_logQ"])184 create_variable(reach_grp, "lowerbound_logWc", "AMHG_wc_min", "m", priors["lowerbound_logWc"])185 create_variable(reach_grp, "upperbound_logWc", "AMHG_wc_min", "m", priors["upperbound_logWc"])186 create_variable(reach_grp, "lowerbound_logQc", "AMHG_Qc_min", "m^3/s", priors["lowerbound_logQc"])187 create_variable(reach_grp, "upperbound_logQc", "AMHG_Qc_max", "m^3/s", priors["upperbound_logQc"])188 create_variable(reach_grp, "logWc_hat", "AMHG_wc_mean", "m", priors["logWc_hat"])189 create_variable(reach_grp, "logQc_hat", "AMHG_Qc_mean", "m^3/s", priors["logQc_hat"])190 create_variable(reach_grp, "logQ_sd", "Discharge_sd", "m^3/s", priors["logQ_sd"])191 create_variable(reach_grp, "logWc_sd", "AMHG_wc_sd", "m", priors["logWc_sd"])192 create_variable(reach_grp, "logQc_sd", "AMHG_qc_min", "m^3/s", priors["logQc_sd"])193 create_variable(reach_grp, "Werr_sd", "Width_measurement_error", "m", priors["Werr_sd"])194 create_variable(reach_grp, "Serr_sd", "Slope_measurement_error", "m/m", priors["Serr_sd"])195 create_variable(reach_grp, "dAerr_sd", "d_Area_measurement_error", "m", priors["dAerr_sd"])196 create_variable(reach_grp, "sigma_man", "Manning_structural_error", "NA", priors["sigma_man"])197 create_variable(reach_grp, "sigma_amhg", "AMHG_structural_error", "NA", priors["sigma_amhg"])198def create_variable(group, name, long_name, units, value):199 """Create NetCDF4 variable and assign data to it."""200 netcdf_var = group.createVariable(name, "f8", fill_value = Output.FILL_VALUE)201 netcdf_var.long_name = long_name202 netcdf_var.units = units203 if np.isnan(value) or value is rinterface.NA_Integer or value is rinterface.NA_Logical:204 value = Output.FILL_VALUE205 netcdf_var.assignValue(value)206def create_nx(length, dataset):207 """Create node dimension and coordinate variable."""208 209 dataset.createDimension("nx", length[0])210 nx = dataset.createVariable("nx", "i4", ("nx",))211 nx.units = "node"212 nx.long_name = "nx"...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful