Get soil/weather data from data holder

@param expData The experiment data holder
@param key The key name for soil/weather section
@return the list of data holder
173958
private ArrayList readSWData(HashMap expData, String key) {
        ArrayList ret;
        Object soil = expData.get(key);
        if (soil != null) {
            if (soil instanceof ArrayList) {
                ret = (ArrayList) soil;
            } else {
                ret = new ArrayList();
                ret.add(soil);
            }
        } else {
            ret = new ArrayList();
        }

        return ret;
    }
1108041
public IData getData(final long pDataKey) throws TTIOException {
        checkArgument(pDataKey >= 0);
        checkState(!mClose, "Transaction already closed");
        // Calculate bucket and data part for given datakey.
        final long seqBucketKey = pDataKey >> IConstants.INDIRECT_BUCKET_COUNT[3];
        final int dataBucketOffset = dataBucketOffset(pDataKey);
        DataBucket bucket = mCache.getIfPresent(seqBucketKey);
        if (bucket == null) {
            final List<DataBucket> listRevs = getSnapshotBuckets(seqBucketKey);
            final DataBucket[] revs = listRevs.toArray(new DataBucket[listRevs.size()]);
            checkState(revs.length > 0, "Number of Buckets to reconstruct must be larger than 0");
            // Build up the complete bucket.
            final IRevisioning revision = mSession.getConfig().mRevision;
            bucket = revision.combineBuckets(revs);
            mCache.put(seqBucketKey, bucket);
        }
        final IData returnVal = bucket.getData(dataBucketOffset);
        // root-fsys is excluded from the checkagainst deletion based on the necesssity of the data-layer to
        // reference against this data while creation of the transaction
        if (pDataKey == 0) {
            return returnVal;
        } else {
            return checkItemIfDeleted(returnVal);
        }

    }
1282906
@Override
    public Data readBackupData(Data key) {
        Record record = getRecord(key);

        if (record == null) {
            return null;
        } else {
            if (partitionService.isPartitionOwner(partitionId)) {
                // set last access time to prevent
                // premature removal of the entry because
                // of idleness based expiry
                record.setLastAccessTime(Clock.currentTimeMillis());
            }
        }

        Object value = record.getValue();
        mapServiceContext.interceptAfterGet(name, value);
        // this serialization step is needed not to expose the object, see issue 1292
        return mapServiceContext.toData(value);
    }
424039
public String getParam(final String key) {
        AssertUtils.notEmpty(key, "key must not be null or empty.");
        return mParams.get(key);
    }
259566
public static HashMap<String, ArrayList<String>> getEto(HashMap data) {
        HashMap<String, ArrayList<String>> results = new HashMap<String, ArrayList<String>>();
        HashMap wthData = getWthData(data);
        ArrayList<HashMap<String, String>> dailyArr = getDailyData(data);

        // Step 1. Atmospheric pressure (P) [kPa]
        String wst_elev = getValueOr(wthData, "wst_elev", "");
        if (wst_elev.equals("")) {
            return results;
        }
        String P = multiply("101.3", pow(divide(substract("293", product("0.0065", wst_elev)), "293"), "5.26"));

        // Step 2. Psychrometric constant (γ)
        String gamma = product("0.664742", "0.001", P);

        // Eq.17 (Step 8)
        // latitude [rad]
        String wst_lat = getValueOr(wthData, "wst_lat", "");
        String phi = divide(product(wst_lat, Math.PI + ""), "180");

        // Get other potentially necessary meta data from Ace data set
        String psyvnt = getValueOr(wthData, "psyvnt", "").trim();
        String aPsy = "";
        if (psyvnt.equals("Forced")) {
            aPsy = "0.000662";
        } else if (psyvnt.equals("Natural")) {
            aPsy = "0.00800";
        }
        String rPsy = multiply(aPsy, P);
        String amth = getValueOr(wthData, "amth", "0.25");
        String bmth = getValueOr(wthData, "bmth", "0.50");

        // Calculate daily ETO
        ArrayList<String> etoArr = new ArrayList<String>();
        for (int i = 0; i < dailyArr.size(); i++) {
            HashMap<String, String> dailyData = dailyArr.get(i);

            // Get daily TMAX and TMIN
            String tMin = getValueOr(dailyData, "tmin", "").trim();
            String tMax = getValueOr(dailyData, "tmax", "").trim();
            if (tMin.equals("") || tMax.equals("")) {
                etoArr.add(null);
                continue;
            }

            // Step 3. Mean air temperature (Tmean) [°C]
            String tMean = average(tMin, tMax);

            // Step 4. Saturation vapour pressure (es)
            String e_tMax = multiply("0.6108", exp(divide(multiply("17.27", tMax), sum(tMax, "237.3"))));
            String e_tMin = multiply("0.6108", exp(divide(multiply("17.27", tMin), sum(tMin, "237.3"))));
            String es = average(e_tMax, e_tMin);

            // Step 5. Slope of the saturation vapour pressure curve (Δ)
            String slope = divide(product("4098", "0.6108", exp(divide(multiply("17.27", tMean), sum(tMean, "237.3")))), pow(sum(tMean, "237.3"), "2"));

            // Step 6. Actual vapour pressure (ea) [kPa]
            String ea;
            String alt1;
            String alt2;
            // Method 1 IF VPRSD is available in the ACE data base
            if (!(alt1 = getValueOr(dailyData, "vprsd", "").trim()).equals("")) {
                // ea = VPRSD
                ea = alt1;

            } // Method 2 IF TDEW is available in the ACE data base
            else if (!(alt1 = getValueOr(dailyData, "tdew", "").trim()).equals("")) {
                // derive ea from the given dew point temperature
                ea = multiply("0.6108", exp(divide(multiply("17.27", alt1), sum(alt1, "237.3"))));

            } // Method 3 IF RHMND and RHMXD are available in the ACE data base
            else if (!(alt1 = getValueOr(dailyData, "rhmxd", "").trim()).equals("")
                    && !(alt2 = getValueOr(dailyData, "rhmnd", getValueOr(dailyData, "rhumd", "")).trim()).equals("")) {
                // ea from the given maximum and minimum Relative Humidity
                ea = average(product(e_tMin, alt1, "0.01"), product(e_tMax, alt2, "0.01"));

            } // Method 4 IF TDRY, TWET and PSYVNT are available in the ACE data base
            else if (!(alt1 = getValueOr(dailyData, "tdry", "").trim()).equals("")
                    && !(alt2 = getValueOr(dailyData, "twet", "").trim()).equals("")
                    && rPsy != null) {
                // derive ea from the psychrometric data
                String e_tWet = multiply("0.6108", exp(divide(multiply("17.27", alt2), sum(alt2, "237.3"))));
                ea = substract(e_tWet, multiply(rPsy, substract(alt1, alt2)));

            } // Method 5 use Tmin as an approximation of Tdew
            else {
                ea = e_tMin;
            }

            // Step 7. Vapour pressure difference (es - ea)
            String vpDiff = substract(es, ea);

            // Step 8. Extra terrestrial radiation (Ra) and daylight hours (N)
            Date w_date = convertFromAgmipDateString(getValueOr(dailyData, "w_date", ""));
            if (w_date == null) {
                etoArr.add(null);
                continue;
            }
            Calendar cal = Calendar.getInstance();
            cal.setTime((w_date));
            String J = cal.get(Calendar.DAY_OF_YEAR) + "";
            String dr = sum("1", multiply("0.033", cos(product("2", divide(Math.PI + "", "365"), J))));
            String delta = multiply("0.409", sin(substract(product("2", divide(Math.PI + "", "365"), J), "1.39")));
            String omegas = acos(product("-1", tan(phi), tan(delta)));
            String ra = divide(product("1440", "0.0820", dr, sum(product(omegas, sin(phi), sin(delta)), product(cos(phi), cos(delta), sin(omegas)))), Math.PI + ""); // TODO
            String N = divide(multiply("24", omegas), Math.PI + "");

            // Step 9. Solar radiation (Rs)
            String rs;
            // Method 1. IF SRAD is available in the ACE data base
            if (!(alt1 = getValueOr(dailyData, "srad", "").trim()).equals("")) {
                rs = alt1;
            } // Method 2. IF SUNH is available in the ACE data base
            else if (!(alt1 = getValueOr(dailyData, "sunh", "").trim()).equals("")) {
                rs = multiply(sum(amth, divide(multiply(bmth, alt1), N)), ra);
            } // Method 3. LSE use Tmin and Tmax to estimate Rs by means of the Hargreaves equation
            else {
                rs = product(getKrsValue(wthData), sqrt(substract(tMax, tMin)), ra);
            }

            // Step 10. Clear-Sky solar radiation (Rso)
            String rso = multiply(sum("0.75", product("2e-5", wst_elev)), ra);

            // Step 11. Net solar radiation (Rns)
            String rns = multiply(substract("1", "0.23"), rs);

            // Step 12. Net long wave  radiation (Rnl)
            String rnl = product("4.903e-9",
                    average(pow(sum(tMax, "273.16"), "4"), pow(sum(tMin, "273.16"), "4")),
                    substract("0.34", multiply("0.14", sqrt(ea))),
                    substract(divide(multiply("1.35", rs), rso), "0.35"));

            // Step 13. Net radiation (Rn)
            String rn = substract(rns, rnl);

            // Step 14. Wind speed at 2 meter above ground level (u2)
            // Method 1. WIND is given in the ACE data base
            String u2;
            if (!(alt1 = getValueOr(dailyData, "wind", "").trim()).equals("")) {
                String uz = divide(multiply("1000", alt1), "86400", 4);
                // CASE 1. Reference height for wind speed measurement (WNDHT)  is 2 meter
                if (compare(alt2 = getValueOr(wthData, "wndht", "").trim(), "2", CompareMode.EQUAL)) {
                    u2 = uz;
                } // CASE 2. Reference height for wind speed measurement (WNDHT)  is NOT 2 meter
                else {
                    u2 = divide(multiply(uz, "4.87"), log(substract(multiply("67.8", alt2), "5.42")));
                }
            } else {
                u2 = "2";
            }

            // Step 15. Reference evapotranspiration (ETo)
            String eto = divide(
                    sum(product("0.408", slope, rn), divide(product(gamma, "900", u2, vpDiff), sum(tMean, "273"))),
                    sum(slope, multiply(gamma, sum("1", multiply("0.34", u2)))));
            etoArr.add(round(eto, 2));
        }
        results.put("eto", etoArr);
        return results;
    }
709766
public function store($key, $data, $expiration = 0)
    {
        $compress_data = gzcompress($data, 9);
        $storeData = array(
            'time' => time(),
            'expire' => $expiration,
            'data' => base64_encode($compress_data)
        );
        if (true === is_array($this->_loadCache())) {
            $dataArray = $this->_loadCache();
            $dataArray[$key] = $storeData;
        } else {
            $dataArray = array($key => $storeData);
        }
        $cacheData = json_encode($dataArray);

        file_put_contents($this->getCacheDir(), $cacheData);
        return $this;
    }
1349208
public List<V> get(K key){
		return (List<V>)map.get(key);
	}
627479
@Override
    public List<Object> getProperty(String key) {
        List<?> nodes = fetchNodeList(key);

        if (nodes.size() == 0) {
            return null;
        } else {
            List<Object> list = new ArrayList<>();
            for (Object node : nodes) {
                ConfigurationNode configurationNode = (ConfigurationNode) node;
                if (configurationNode.getValue() != null) {
                    list.add(configurationNode.getValue());
                }
            }

            if (list.size() < 1) {
                return null;
            } else {
                return list;
            }
        }
    }
223842
static MPApiResponse getFromCache(String key) {
        HashMap<String, MPApiResponse> mapCache = getMapCache();
        MPApiResponse response = null;
        try {
            response = mapCache.get(key).clone();
        } catch (Exception ex) {
            // Do nothing
        }
        if (response != null) {
            response.fromCache = Boolean.TRUE;
        }
        return response;
    }
739198
@SuppressWarnings("unchecked")
    @Override
    public List<T> multiGet(List<List<Object>> keys) {
        try {
            List<T> values = new ArrayList<T>();

            for (List<Object> rowKey : keys) {
                Statement statement = mapper.retrieve(rowKey);
                ResultSet results = session.execute(statement);
                // TODO: Better way to check for empty results besides accessing entire results list
                Iterator<Row> rowIter = results.iterator();
                Row row;
                if (results != null && rowIter.hasNext() && (row = rowIter.next()) != null) {
                    if (rowIter.hasNext()) {
                        LOG.error("Found non-unique value for key [{}]", rowKey);
                    } else {
                        values.add((T) mapper.getValue(row));
                    }
                } else {
                    values.add(null);
                }
            }

            _mreads.incrBy(values.size());
            LOG.debug("Retrieving the following keys: {} with values: {}", keys, values);
            return values;
        } catch (Exception e) {
            checkCassandraException(e);
            throw new IllegalStateException("Impossible to reach this code");
        }
    }
1129038
public AceExperiment getExperiment(String exname) {
        if (this.eidMap.containsKey(exname)) {
            return this.experimentMap.get(eidMap.get(exname));
        } else {
            return null;
        }
    }
1147995
public <T> List<T> getList(AppConfigKey key, Class<T> c) {
        Object o = data.get(key);
        if (null == o) {
            List<T> l = key.implList(key.key(), raw, c);
            data.put(key, l);
            return l;
        } else {
            return (List) o;
        }
    }
52984
public Element getWithData(Ehcache cache, Object key, A data) {
        this.threadData.set(data);
        try {
            return cache.get(key);
        } finally {
            this.threadData.remove();
        }
    }
562658
List<V> get( K key ) {
        List<V> result = map.get( key );
        if( parent != null ) {
            List<V> resultParent = parent.get( key );
            if( result == null ) {
                return resultParent;
            } else if( resultParent == null ){
                return result;
            } else {
                for( V value : resultParent ) {
                    if( !result.contains( value ) ) {
                        result.add( value );
                    }
                }
            }
        }
        return result;
    }
262329
@Override
    public T get(Object key) {
        String sKey = (String) key;
        if (StringUtils.isBlank(sKey) && this.hasDefaultEnvironment()) {
            sKey = defaultEnvironment;
        } else if (StringUtils.isBlank(sKey)) {
            throw new MultiEnvSupportException("[environment] property is mandatory and can't be empty");
        }
        T value = map.get(sKey);
        if (value == null) {
            if (creationFunction != null) {
                value = creationFunction.apply(sKey);
            } else {
                value = resolve(sKey, getTemplate());
            }

            if (value != null) {
                map.put(sKey, value);
            }
        }

        return value;
    }
660067
@Override
    public V get(Object key) {
        // Keys can not be null
        if (key == null) {
            throw new NullPointerException("Key can not be null");
        }
        if (!(key instanceof String)) {
            throw new ClassCastException("Only String keys are supported -- got " + key.getClass());
        }
        // Empty keys are stored in the root
        if (key.equals("")) {
            if (root.getRight() == null) {
                return null;
            } else {
                return root.getRight().getValue();
            }
        }

        // Find nearest node
        PatriciaNode<V> nearest = findNearestNode((String) key);

        // If the nearest node matches key, we have a match
        if (key.equals(nearest.getKey())) {
            return nearest.getValue();
        } else {
            return null;
        }
    }
748215
public Object get(String key) {
    if (!StringUtil.isEmpty(key)) {
      if (pendingInstanceData.containsKey(key)) {
        return pendingInstanceData.get(key);
      }
      if (instanceData.containsKey(key)) {
        return instanceData.get(key);
      }
    }
    return null;
  }