repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
tvm | tvm-main/rust/tvm-graph-rt/tests/test_tvm_dso/src/build_test_lib.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 1,461 | 32.227273 | 66 | py |
tvm | tvm-main/rust/tvm-graph-rt/tests/test_nn/src/build_test_graph.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 1,945 | 33.75 | 81 | py |
tvm | tvm-main/conda/render_cuda_dockerfiles.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 1,876 | 29.770492 | 97 | py |
tvm | tvm-main/jvm/core/src/test/scripts/test_graph_executor.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 2,154 | 29.785714 | 100 | py |
tvm | tvm-main/jvm/core/src/test/scripts/test_add_cpu.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 1,426 | 31.431818 | 87 | py |
tvm | tvm-main/jvm/core/src/test/scripts/test_add_gpu.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 2,008 | 33.050847 | 93 | py |
tvm | tvm-main/jvm/core/src/test/scripts/test_rpc_proxy_server.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 1,279 | 31 | 65 | py |
tvm | tvm-main/golang/sample/gen_mobilenet_lib.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 3,107 | 30.714286 | 96 | py |
tvm | tvm-main/golang/sample/deploy.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 1,815 | 30.859649 | 70 | py |
tvm | tvm-main/ci/jenkins/generate.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 6,521 | 31.773869 | 100 | py |
tvm | tvm-main/ci/jenkins/data.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 3,871 | 30.479675 | 89 | py |
tvm | tvm-main/ci/scripts/jenkins/should_rebuild_docker.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 4,962 | 31.019355 | 128 | py |
tvm | tvm-main/ci/scripts/jenkins/determine_docker_images.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 4,552 | 33.492424 | 128 | py |
tvm | tvm-main/ci/scripts/jenkins/http_utils.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 1,318 | 36.685714 | 78 | py |
tvm | tvm-main/ci/scripts/jenkins/open_docker_update_pr.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 7,518 | 35.857843 | 98 | py |
tvm | tvm-main/ci/scripts/jenkins/pytest_wrapper.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 5,095 | 35.661871 | 239 | py |
tvm | tvm-main/ci/scripts/jenkins/should_run_slow_tests.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 2,840 | 30.921348 | 99 | py |
tvm | tvm-main/ci/scripts/jenkins/git_skip_ci_globs.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 2,435 | 28.707317 | 117 | py |
tvm | tvm-main/ci/scripts/jenkins/git_utils.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 7,458 | 34.183962 | 132 | py |
tvm | tvm-main/ci/scripts/jenkins/cmd_utils.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 2,620 | 29.835294 | 94 | py |
tvm | tvm-main/ci/scripts/jenkins/check_pr.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 4,484 | 29.719178 | 101 | py |
tvm | tvm-main/ci/scripts/jenkins/git_skip_ci.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 2,422 | 37.460317 | 94 | py |
tvm | tvm-main/ci/scripts/jenkins/pytest_ids.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 1,511 | 33.363636 | 84 | py |
tvm | tvm-main/ci/scripts/jenkins/s3.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 4,713 | 30.013158 | 100 | py |
tvm | tvm-main/ci/scripts/github/github_tag_teams.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 9,598 | 31.103679 | 100 | py |
tvm | tvm-main/ci/scripts/github/github_docs_comment.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 2,036 | 36.722222 | 94 | py |
tvm | tvm-main/ci/scripts/github/github_cc_reviewers.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 4,380 | 35.815126 | 93 | py |
tvm | tvm-main/ci/scripts/github/github_commenter.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 5,455 | 38.251799 | 317 | py |
tvm | tvm-main/ci/scripts/github/github_tvmbot.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 26,749 | 32.188586 | 364 | py |
tvm | tvm-main/ci/scripts/github/update_branch.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 6,954 | 31.652582 | 100 | py |
tvm | tvm-main/ci/scripts/github/ping_reviewers.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 9,111 | 33.384906 | 291 | py |
tvm | tvm-main/ci/scripts/github/github_skipped_tests_comment.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 9,334 | 34.093985 | 110 | py |
tvm | tvm-main/ci/scripts/github/__init__.py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | 937 | 45.9 | 100 | py |
tvm | tvm-main/ci/scripts/github/github_pr_comment.py | #!/usr/bin/env python3
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "L... | 4,417 | 28.851351 | 81 | py |
TPlinker-joint-extraction | TPlinker-joint-extraction-master/setup.py | from setuptools import setup, find_packages
setup(name='joint_extr', version='1.0', packages=find_packages()) | 110 | 36 | 65 | py |
TPlinker-joint-extraction | TPlinker-joint-extraction-master/common/utils.py | import re
from tqdm import tqdm
from IPython.core.debugger import set_trace
import copy
import json
import os
class DefaultLogger:
def __init__(self, log_path, project, run_name, run_id, hyperparameter):
self.log_path = log_path
log_dir = "/".join(self.log_path.split("/")[:-1])
if not os.pa... | 16,727 | 47.346821 | 164 | py |
TPlinker-joint-extraction | TPlinker-joint-extraction-master/common/components.py | from IPython.core.debugger import set_trace
import torch
import torch.nn as nn
from torch.nn.parameter import Parameter
import math
class LayerNorm(nn.Module):
def __init__(self, input_dim, cond_dim = 0, center = True, scale = True, epsilon = None, conditional = False,
hidden_units = None, hidden_... | 7,502 | 44.472727 | 135 | py |
TPlinker-joint-extraction | TPlinker-joint-extraction-master/common/__init__.py | 0 | 0 | 0 | py | |
TPlinker-joint-extraction | TPlinker-joint-extraction-master/preprocess/__init__.py | from joint_extraction import * | 30 | 30 | 30 | py |
TPlinker-joint-extraction | TPlinker-joint-extraction-master/tplinker/tplinker.py | import re
from tqdm import tqdm
from IPython.core.debugger import set_trace
import copy
import torch
import torch.nn as nn
import json
from torch.nn.parameter import Parameter
from common.components import HandshakingKernel
import math
class HandshakingTaggingScheme(object):
"""docstring for HandshakingTaggingSche... | 31,326 | 46.108271 | 222 | py |
TPlinker-joint-extraction | TPlinker-joint-extraction-master/tplinker/config.py | import string
import random
common = {
"exp_name": "nyt_star",
"rel2id": "rel2id.json",
"device_num": 0,
# "encoder": "BiLSTM",
"encoder": "BERT",
"hyper_parameters": {
"shaking_type": "cat", # cat, cat_plus, cln, cln_plus; Experiments show that cat/cat_plus work better with BiLSTM, wh... | 5,148 | 39.226563 | 301 | py |
TPlinker-joint-extraction | TPlinker-joint-extraction-master/tplinker/__init__.py | 0 | 0 | 0 | py | |
TPlinker-joint-extraction | TPlinker-joint-extraction-master/tplinker/train.py | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
import json
import os
from tqdm import tqdm
import re
from IPython.core.debugger import set_trace
from pprint import pprint
from transformers import AutoModel, BertTokenizerFast
import copy
import torch
import torch.nn as nn
from torch.utils.data import DataLoader, Data... | 24,510 | 39.050654 | 310 | py |
TPlinker-joint-extraction | TPlinker-joint-extraction-master/tplinker_plus/config.py | import string
import random
common = {
"exp_name": "duie2", # ace05_lu
"rel2id": "rel2id.json",
"ent2id": "ent2id.json",
"device_num": 1,
# "encoder": "BiLSTM",
"encoder": "BERT",
"hyper_parameters": {
"shaking_type": "cln_plus",
"inner_enc_type": "lstm",
# match_pa... | 4,688 | 35.92126 | 238 | py |
TPlinker-joint-extraction | TPlinker-joint-extraction-master/tplinker_plus/__init__.py | 0 | 0 | 0 | py | |
TPlinker-joint-extraction | TPlinker-joint-extraction-master/tplinker_plus/tplinker_plus.py | import re
from tqdm import tqdm
import torch
from IPython.core.debugger import set_trace
import copy
import torch
import torch.nn as nn
import json
from torch.nn.parameter import Parameter
import torch.nn.functional as F
import math
from common.components import HandshakingKernel
from collections import Counter
class ... | 37,902 | 47.59359 | 220 | py |
TPlinker-joint-extraction | TPlinker-joint-extraction-master/tplinker_plus/train.py | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
import json
import os
from tqdm import tqdm
import re
from IPython.core.debugger import set_trace
from pprint import pprint
import unicodedata
from transformers import BertModel, BertTokenizerFast
import copy
import torch
import torch.nn as nn
import torch.nn.functional... | 26,441 | 37.266281 | 252 | py |
netcdf4-python | netcdf4-python-master/setup.py | import os, sys, subprocess, glob
import os.path as osp
import shutil
import configparser
from setuptools import setup, Extension
from setuptools.dist import Distribution
open_kwargs = {'encoding': 'utf-8'}
def check_hdf5version(hdf5_includedir):
try:
f = open(os.path.join(hdf5_includedir, 'H5public.h'), ... | 28,981 | 37.285337 | 107 | py |
netcdf4-python | netcdf4-python-master/checkversion.py | import netCDF4, numpy
print('netcdf4-python version: %s'%netCDF4.__version__)
print('HDF5 lib version: %s'%netCDF4.__hdf5libversion__)
print('netcdf lib version: %s'%netCDF4.__netcdf4libversion__)
print('numpy version %s' % numpy.__version__)
| 263 | 43 | 65 | py |
netcdf4-python | netcdf4-python-master/examples/bench_diskless.py | # benchmark reads and writes, with and without compression.
# tests all four supported file formats.
from numpy.random.mtrand import uniform
import netCDF4
from timeit import Timer
import os, sys
# create an n1dim by n2dim by n3dim random array.
n1dim = 30
n2dim = 15
n3dim = 73
n4dim = 144
ntrials = 10
sys.stdout.writ... | 2,750 | 39.455882 | 111 | py |
netcdf4-python | netcdf4-python-master/examples/bench_compress2.py | # benchmark reads and writes, with and without compression.
# tests all four supported file formats.
from numpy.random.mtrand import uniform
import netCDF4
from timeit import Timer
import os, sys
# create an n1dim by n2dim by n3dim random array.
n1dim = 30
n2dim = 15
n3dim = 73
n4dim = 144
ntrials = 10
sys.stdout.writ... | 2,604 | 38.469697 | 106 | py |
netcdf4-python | netcdf4-python-master/examples/test_stringarr.py | from netCDF4 import Dataset, stringtochar, chartostring
import random, numpy
# test utilities for converting arrays of fixed-length strings
# to arrays of characters (with an extra dimension), and vice-versa.
# netCDF does not have a fixed-length string data-type (only characters
# and variable length strings). The c... | 1,883 | 37.44898 | 73 | py |
netcdf4-python | netcdf4-python-master/examples/tutorial.py | from netCDF4 import Dataset
# code from tutorial.
# create a file (Dataset object, also the root group).
rootgrp = Dataset('test.nc', 'w', format='NETCDF4')
print(rootgrp.file_format)
rootgrp.close()
# create some groups.
rootgrp = Dataset('test.nc', 'a')
fcstgrp = rootgrp.createGroup('forecasts')
analgrp = rootgrp.... | 13,476 | 36.645251 | 98 | py |
netcdf4-python | netcdf4-python-master/examples/json_att.py | from netCDF4 import Dataset
import json
# example showing how python objects (lists, dicts, None, True)
# can be serialized as strings, saved as netCDF attributes,
# and then converted back to python objects using json.
ds = Dataset('json.nc', 'w')
ds.pythonatt1 = json.dumps(['foo', {'bar': ['baz', None, 1.0, 2]}])
ds... | 688 | 26.56 | 68 | py |
netcdf4-python | netcdf4-python-master/examples/threaded_read.py | from netCDF4 import Dataset
from numpy.testing import assert_array_equal, assert_array_almost_equal
import numpy as np
import threading
import queue
import time
# demonstrate reading of different files from different threads.
# Releasing the Global Interpreter Lock (GIL) when calling the
# netcdf C library for read op... | 1,690 | 25.84127 | 71 | py |
netcdf4-python | netcdf4-python-master/examples/mpi_example_compressed.py | # to run: mpirun -np 4 python mpi_example_compressed.py
import sys
from mpi4py import MPI
import numpy as np
from netCDF4 import Dataset
rank = MPI.COMM_WORLD.rank # The process ID (integer 0-3 for 4-process run)
nc = Dataset('parallel_test_compressed.nc', 'w', parallel=True)
d = nc.createDimension('dim',4)
v = nc.cre... | 690 | 35.368421 | 88 | py |
netcdf4-python | netcdf4-python-master/examples/bench.py | # benchmark reads and writes, with and without compression.
# tests all four supported file formats.
from numpy.random.mtrand import uniform
import netCDF4
from timeit import Timer
import os, sys
# create an n1dim by n2dim by n3dim random array.
n1dim = 30
n2dim = 15
n3dim = 73
n4dim = 144
ntrials = 10
sys.stdout.writ... | 1,607 | 37.285714 | 123 | py |
netcdf4-python | netcdf4-python-master/examples/bench_compress3.py | # benchmark reads and writes, with and without compression.
# tests all four supported file formats.
from numpy.random.mtrand import uniform
import netCDF4
from timeit import Timer
import os, sys
# use real data.
URL="http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/ncep.reanalysis/pressure/hgt.1990.nc"
nc = netCDF... | 2,788 | 37.205479 | 100 | py |
netcdf4-python | netcdf4-python-master/examples/bench_compress.py | # benchmark reads and writes, with and without compression.
# tests all four supported file formats.
from numpy.random.mtrand import uniform
import netCDF4
from timeit import Timer
import os, sys
# create an n1dim by n2dim by n3dim random array.
n1dim = 30
n2dim = 15
n3dim = 73
n4dim = 144
ntrials = 10
sys.stdout.writ... | 1,896 | 38.520833 | 106 | py |
netcdf4-python | netcdf4-python-master/examples/subset.py | # use 'orthogonal indexing' feature to subselect data over CONUS.
import netCDF4
import numpy as np
import matplotlib.pyplot as plt
# use real data from CFS reanalysis.
# note: we're reading GRIB2 data!
URL="http://nomads.ncdc.noaa.gov/thredds/dodsC/modeldata/cmd_flxf/2010/201007/20100701/flxf00.gdas.2010070100.grb2"... | 647 | 39.5 | 115 | py |
netcdf4-python | netcdf4-python-master/examples/mpi_example.py | # to run: mpirun -np 4 python mpi_example.py
import sys
from mpi4py import MPI
import numpy as np
from netCDF4 import Dataset
if len(sys.argv) == 2:
format = sys.argv[1]
else:
format = 'NETCDF4_CLASSIC'
rank = MPI.COMM_WORLD.rank # The process ID (integer 0-3 for 4-process run)
if rank == 0:
print('Creating file wi... | 1,471 | 33.232558 | 76 | py |
netcdf4-python | netcdf4-python-master/examples/bench_compress4.py | # benchmark reads and writes, with and without compression.
# tests all four supported file formats.
from numpy.random.mtrand import uniform
import netCDF4
from timeit import Timer
import os, sys
# use real data.
URL="http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/ncep.reanalysis/pressure/hgt.1990.nc"
nc = netCDF... | 1,988 | 36.528302 | 100 | py |
netcdf4-python | netcdf4-python-master/src/netCDF4/utils.py | import sys
import numpy as np
from numpy import ma
from numpy.lib.stride_tricks import as_strided
import warnings
import getopt
import os
try:
bytes
except NameError:
# no bytes type in python < 2.6
bytes = str
def _safecast(a,b):
# check to see if array a can be safely cast
# to array b. A littl... | 37,383 | 37.699793 | 209 | py |
netcdf4-python | netcdf4-python-master/src/netCDF4/__init__.py | # init for netCDF4. package
# Docstring comes from extension module _netCDF4.
from ._netCDF4 import *
# Need explicit imports for names beginning with underscores
from ._netCDF4 import __doc__
from ._netCDF4 import (__version__, __netcdf4libversion__, __hdf5libversion__,
__has_rename_grp__, __has... | 1,455 | 55 | 261 | py |
netcdf4-python | netcdf4-python-master/test/tst_masked.py | import sys
import unittest
import os
import tempfile
import numpy as np
from numpy import ma
from numpy.testing import assert_array_equal, assert_array_almost_equal
from numpy.random.mtrand import uniform
import netCDF4
from numpy.ma import masked_all
# test automatic conversion of masked arrays, and
# packing/unpacki... | 6,127 | 38.792208 | 75 | py |
netcdf4-python | netcdf4-python-master/test/tst_cdf5.py | from netCDF4 import Dataset
import numpy as np
import sys, os, unittest, tempfile
from numpy.testing import assert_array_equal
FILE_NAME = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
dimsize = np.iinfo(np.int32).max*2 # only allowed in CDF5
ndim = 100
arrdata = np.random.randint(np.iinfo(np.uint8).min... | 1,347 | 33.564103 | 84 | py |
netcdf4-python | netcdf4-python-master/test/tst_shape.py | from netCDF4 import Dataset
import tempfile, unittest, os
import numpy as np
file_name = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
xdim=None; ydim=121; zdim=169
datashape = (ydim,zdim)
data = np.ones(datashape,dtype=np.float64)
class ShapeTestCase(unittest.TestCase):
def setUp(self):
s... | 1,126 | 27.897436 | 72 | py |
netcdf4-python | netcdf4-python-master/test/tst_dap.py | import unittest
import netCDF4
import numpy as np
from datetime import datetime, timedelta
from numpy.testing import assert_array_almost_equal
# test accessing data over http with opendap.
yesterday = datetime.utcnow() - timedelta(days=1)
URL = f'http://nomads.ncep.noaa.gov/dods/gfs_1p00/gfs{yesterday:%Y%m%d}/gfs_1p0... | 1,246 | 29.414634 | 85 | py |
netcdf4-python | netcdf4-python-master/test/tst_masked2.py | import sys
import unittest
import os
import tempfile
import numpy as np
from numpy import ma, seterr
from numpy.testing import assert_array_equal, assert_array_almost_equal
from netCDF4 import Dataset, default_fillvals
seterr(over='ignore') # don't print warning for overflow errors
# test automatic conversion of mask... | 4,211 | 32.967742 | 98 | py |
netcdf4-python | netcdf4-python-master/test/tst_scaled.py | import unittest
import os
import tempfile
import numpy as np
from numpy import ma
from numpy.testing import assert_array_almost_equal
from netCDF4 import Dataset, default_fillvals
# Test automatic scaling of variables (set_auto_scale())
class SetAutoScaleTestBase(unittest.TestCase):
"""Base object for tests ch... | 7,326 | 27.960474 | 96 | py |
netcdf4-python | netcdf4-python-master/test/tst_refcount.py | import unittest, netCDF4, tempfile, os
file_name = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
class RefCountTestCase(unittest.TestCase):
def setUp(self):
nc = netCDF4.Dataset(file_name, mode='w', keepweakref=True, format='NETCDF4')
d = nc.createDimension('fred', 2000)
v ... | 978 | 32.758621 | 85 | py |
netcdf4-python | netcdf4-python-master/test/tst_unicodeatt.py | from netCDF4 import Dataset
import sys, unittest, os, tempfile
FILE_NAME = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
class UnicodeAttTestCase(unittest.TestCase):
def setUp(self):
self.file = FILE_NAME
nc = Dataset(self.file,'w')
# write as a utf-8 string
nc.stra... | 1,344 | 36.361111 | 83 | py |
netcdf4-python | netcdf4-python-master/test/tst_enum.py | import sys
import unittest
import os
import tempfile
from netCDF4 import Dataset
import numpy as np
from numpy.testing import assert_array_equal
FILE_NAME = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
ENUM_NAME = 'cloud_t'
ENUM_BASETYPE = np.int8
VAR_NAME = 'primary_cloud'
ENUM_DICT = {'Altocumulus': ... | 3,348 | 36.211111 | 89 | py |
netcdf4-python | netcdf4-python-master/test/tst_open_mem.py | import os
import unittest
import netCDF4
CURRENT_DIR = os.path.dirname(os.path.realpath(__file__))
class TestOpenMem(unittest.TestCase):
def test_mem_open(self):
fpath = os.path.join(CURRENT_DIR, "netcdf_dummy_file.nc")
with open(fpath, 'rb') as f:
nc_bytes = f.read()
if... | 986 | 29.84375 | 67 | py |
netcdf4-python | netcdf4-python-master/test/tst_compoundvar.py | import sys
import unittest
import os
import tempfile
from netCDF4 import Dataset, CompoundType
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
# test compound data types.
FILE_NAME = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
DIM_NAME = 'phony_dim'
GROUP_NA... | 6,011 | 41.041958 | 87 | py |
netcdf4-python | netcdf4-python-master/test/tst_multifile.py | from netCDF4 import Dataset, MFDataset, MFTime
import numpy as np
from numpy.random import seed, randint
from numpy.testing import assert_array_equal, assert_equal
from numpy import ma
import tempfile, unittest, os, datetime
import cftime
from pkg_resources import parse_version
nx=100; ydim=5; zdim=10
nfiles = 10
ninc... | 6,295 | 36.927711 | 105 | py |
netcdf4-python | netcdf4-python-master/test/tst_create_mem.py | import unittest
import netCDF4
import numpy as np
from numpy.testing import assert_array_equal
class TestCreateMem(unittest.TestCase):
def test_mem_create(self):
def check_inmemory(format):
# memory is 'advisory size' - not needed for NETCDF4/HDF5
# but is used for NETCDF3.
... | 924 | 33.259259 | 73 | py |
netcdf4-python | netcdf4-python-master/test/tst_scalarvar.py | import sys
import unittest
import os
import tempfile
from numpy.testing import assert_almost_equal
import netCDF4
import math
VAR_NAME='temp'
VAR_TYPE='f4'
VAR_VAL=math.pi
FILE_NAME = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
GROUP_NAME = 'subgroup'
# test scalar variable creation and retrieval.
c... | 1,821 | 29.881356 | 72 | py |
netcdf4-python | netcdf4-python-master/test/tst_vars.py | import sys
import unittest
import os
import tempfile
import numpy as np
from numpy.random.mtrand import uniform
from numpy.testing import assert_array_equal, assert_array_almost_equal
import netCDF4
# test variable creation.
FILE_NAME = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
VAR_DOUBLE_NAME="dum... | 3,378 | 34.568421 | 85 | py |
netcdf4-python | netcdf4-python-master/test/tst_compoundatt.py | import sys
import unittest
import os
import tempfile
from netCDF4 import Dataset, CompoundType
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
# test compound attributes.
FILE_NAME = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
DIM_NAME = 'time'
VAR_NAME = 'w... | 2,644 | 34.743243 | 80 | py |
netcdf4-python | netcdf4-python-master/test/tst_diskless.py | import unittest, os, tempfile
import numpy as np
from numpy.random.mtrand import uniform
from numpy.testing import assert_array_equal, assert_array_almost_equal
import netCDF4
# rudimentary test of diskless file capability.
# create an n1dim by n2dim by n3dim random array
n1dim = 10
n2dim = 73
n3dim = 144
ranarr = 10... | 3,009 | 35.707317 | 80 | py |
netcdf4-python | netcdf4-python-master/test/tst_compound_alignment.py | """ This illustrates a bug when a structured array is extracted from a netCDF4.Variable using the slicing operation.
Bug is observed with EPD 7.3-1 and 7.3-2 (64-bit)
"""
import netCDF4, numpy, tempfile, sys, os, unittest
from numpy.testing import assert_array_equal, assert_array_almost_equal
def string_to_bytes(xstr... | 37,907 | 340.513514 | 3,483 | py |
netcdf4-python | netcdf4-python-master/test/tst_utils.py | from numpy.testing import assert_equal
from netCDF4.utils import _StartCountStride, _out_array_shape
import unittest
import numpy as np
class TestgetStartCountStride(unittest.TestCase):
def test_basic(self):
# Basic usage
elem = [0, slice(None), slice(None)]
start, count, stride, put_ind =... | 13,906 | 39.902941 | 121 | py |
netcdf4-python | netcdf4-python-master/test/run_all.py | import glob, os, sys, unittest, struct, tempfile
from netCDF4 import getlibversion,__hdf5libversion__,__netcdf4libversion__,__version__, Dataset
from netCDF4 import __has_cdf5_format__, __has_nc_inq_path__, __has_nc_create_mem__, \
__has_parallel4_support__, __has_pnetcdf_support__, \
... | 3,881 | 43.113636 | 95 | py |
netcdf4-python | netcdf4-python-master/test/tst_atts.py | import math
import subprocess
import sys
import unittest
import os
import tempfile
import warnings
import numpy as np
from collections import OrderedDict
from numpy.random.mtrand import uniform
import netCDF4
# test attribute creation.
#FILE_NAME = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
FILE_NA... | 9,842 | 42.171053 | 87 | py |
netcdf4-python | netcdf4-python-master/test/tst_multiple_open_close.py | import os
import tracemalloc
import unittest
import netCDF4
class MultipleVariablesByAttributesCallsTests(unittest.TestCase):
def test_multiple_calls(self):
netcdf_file = os.path.join(os.path.dirname(__file__), "netcdf_dummy_file.nc")
tracemalloc.start()
snapshot = tracemalloc.take_snaps... | 1,810 | 34.509804 | 151 | py |
netcdf4-python | netcdf4-python-master/test/tst_dims.py | import sys
import unittest
import os
import tempfile
from numpy.random.mtrand import uniform
import netCDF4
FILE_NAME = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
LAT_NAME="lat"
LAT_LEN = 25
LAT_LENG = 50
LON_NAME="lon"
LON_LEN = 50
LON_LENG = 100
LEVEL_NAME="level"
LEVEL_LEN = None
LEVEL_LENG = None... | 6,049 | 39.066225 | 94 | py |
netcdf4-python | netcdf4-python-master/test/tst_Unsigned.py | import unittest
import netCDF4
from numpy.testing import assert_array_equal
import numpy as np
class Test_Unsigned(unittest.TestCase):
"""
Test autoconversion to unsigned ints when _Unsigned attribute is True.
This attribute is is set by netcdf-java to designate unsigned
integer data stored with a sign... | 1,832 | 34.941176 | 76 | py |
netcdf4-python | netcdf4-python-master/test/tst_grps.py | import sys
import unittest
import os
import tempfile
import netCDF4
# test group creation.
FILE_NAME1 = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
FILE_NAME2 = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
DYNASTY = "Tudor"
HENRY_VII = "Henry_VII"
MARGARET = "Margaret"
JAMES_V_OF_SCOT... | 2,519 | 28.647059 | 105 | py |
netcdf4-python | netcdf4-python-master/test/tst_cdl.py | import unittest
import netCDF4
import os
test_ncdump="""netcdf ubyte {
dimensions:
d = 2 ;
variables:
byte ub(d) ;
ub:_Unsigned = "true" ;
byte sb(d) ;
byte sb2(d) ;
sb2:_Unsigned = "false" ;
// global attributes:
:_Format = "classic" ;
}
"""
test_ncdump2="""netcdf ubyte {
dimensions:
d = 2 ;
variables:
b... | 1,624 | 21.569444 | 70 | py |
netcdf4-python | netcdf4-python-master/test/tst_get_variables_by_attributes.py | import os
import unittest
import netCDF4
class VariablesByAttributesTests(unittest.TestCase):
def setUp(self):
netcdf_file = os.path.join(os.path.dirname(__file__), "netcdf_dummy_file.nc")
self.nc = netCDF4.Dataset(netcdf_file)
def test_find_variables_by_single_attribute(self):
vs = ... | 1,771 | 37.521739 | 114 | py |
netcdf4-python | netcdf4-python-master/test/tst_compression.py | from numpy.random.mtrand import uniform
from netCDF4 import Dataset
from netCDF4.utils import _quantize
from numpy.testing import assert_almost_equal
import os, tempfile, unittest
ndim = 100000
ndim2 = 100
chunk1 = 10; chunk2 = ndim2
nfiles = 7
files = [tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name for ... | 7,378 | 45.408805 | 125 | py |
netcdf4-python | netcdf4-python-master/test/tst_types.py | import sys
import unittest
import os
import tempfile
import numpy as np
from numpy.testing import assert_array_equal, assert_array_almost_equal
from numpy.random.mtrand import uniform
import netCDF4
# test primitive data types.
# create an n1dim by n2dim random ranarr.
FILE_NAME = tempfile.NamedTemporaryFile(suffix='... | 3,886 | 38.663265 | 181 | py |
netcdf4-python | netcdf4-python-master/test/tst_fancyslicing.py | from netCDF4 import Dataset
from numpy.random import seed, randint
from numpy.testing import assert_array_equal, assert_equal
import tempfile, unittest, os, random
import numpy as np
"""
Bug note
There seems to be a bug when two unlimited dimensions are used,
ie ('x', 'y', 'time'), where x and time are unlimited dime... | 6,576 | 33.255208 | 90 | py |
netcdf4-python | netcdf4-python-master/test/tst_multifile2.py | from netCDF4 import Dataset, MFDataset, MFTime
import numpy as np
from numpy.random import seed, randint
from numpy.testing import assert_array_equal, assert_equal
from numpy import ma
import tempfile, unittest, os, datetime
import cftime
from pkg_resources import parse_version
nx=100; ydim=5; zdim=10
nfiles = 10
ninc... | 4,945 | 35.367647 | 105 | py |
netcdf4-python | netcdf4-python-master/test/tst_unicode.py | import netCDF4
import numpy as np
import sys, unittest, os, tempfile
FILE_NAME = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
ATT1 = '\u03a0\u03a3\u03a9'
ATT2 = 'x\xb0'
ATT3 = ['\u03a0', '\u03a3', '\u03a9']
DIM_NAME = 'x\xb0'
VAR_NAME = 'Andr\xe9'
class UnicodeTestCase(unittest.TestCase):
def set... | 1,180 | 26.465116 | 72 | py |
netcdf4-python | netcdf4-python-master/test/tst_compression_bzip2.py | from numpy.random.mtrand import uniform
from netCDF4 import Dataset
from numpy.testing import assert_almost_equal
import os, tempfile, unittest, sys
ndim = 100000
filename1 = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
filename2 = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
array = un... | 2,136 | 35.844828 | 125 | py |
netcdf4-python | netcdf4-python-master/test/tst_endian.py | import netCDF4
import numpy as np
import unittest, os, tempfile
from numpy.testing import assert_array_equal, assert_array_almost_equal
data = np.arange(12,dtype='f4').reshape(3,4)
FILE_NAME = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
FILE_NAME2 = tempfile.NamedTemporaryFile(suffix='.nc', delete=Fal... | 6,046 | 34.781065 | 81 | py |
netcdf4-python | netcdf4-python-master/test/tst_compression_quant.py | from numpy.random.mtrand import uniform
from netCDF4 import Dataset
from numpy.testing import assert_almost_equal
import numpy as np
import os, tempfile, unittest
ndim = 100000
nfiles = 7
files = [tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name for nfile in range(nfiles)]
data_array = uniform(size=(ndim,)... | 5,096 | 44.106195 | 132 | py |
netcdf4-python | netcdf4-python-master/test/tst_chunk_cache.py | import unittest, netCDF4, tempfile, os
file_name = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name
cache_size = 10000
cache_nelems = 100
cache_preempt = 0.5
cache_size2 = 20000
cache_nelems2 = 200
cache_preempt2 = 1.0
class RefCountTestCase(unittest.TestCase):
def setUp(self):
nc = netCDF4.... | 1,570 | 36.404762 | 97 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.